Hi all,
I'm having a hard time understanding how to compare url strings. Here's my scenario:
I have a button in my page that redirects user to another page. I would like to grab that url string and compare it with the url of the actual page the user is in. If I do an onclick event on the button I can get this url string:
If I do a global call for the page's URL I can also get that string:
The order these alerts happen is first the button URL then the current page URL.
My issue is grabbing both of those values and passing them unto a function to compare them. Could someone please advice how to go about doing this.
Thank you in advance!
I'm having a hard time understanding how to compare url strings. Here's my scenario:
I have a button in my page that redirects user to another page. I would like to grab that url string and compare it with the url of the actual page the user is in. If I do an onclick event on the button I can get this url string:
Code:
function getButtonURL(x){
var buttonURL= window.location.href;
alert ("The button's URL is: " + buttonURL);
}
If I do a global call for the page's URL I can also get that string:
Code:
var URLString = window.location.href;
alert (URLString);
The order these alerts happen is first the button URL then the current page URL.
My issue is grabbing both of those values and passing them unto a function to compare them. Could someone please advice how to go about doing this.
Thank you in advance!