Try something along the lines of this…
$(document).ready(function() {
var url = window.location.href;
var UrlofpageX = url.indexOf('theurlyouwanttolookfor');
if (UrlofpageX >= 0) {
$('.yourlink').append('<a href="https://website-B"><li>Your different link</li></a>');
}
else {
$('.yourlink').append('<a href="https://website-A"><li>Your original link</li></a>');
}
});
So what happens here is you get the URL of the page that you’re currently on. It gets stored in a variable. You then look for the words within that URL that will determine that you are on this particular page X and not some other page.
Then you run an If/else. IF the variable has something in it after the check then you know you’re on page X and you append a new link. ELSE you’re on a normal page and you set the regular link.
2
solved Change link URL to a different link depending on the page