I can't find out why this is not working:
var myurl = "http://domain.com";
var currenturl = $(location).attr('href');
if (myurl == currenturl) {
...
Both myurl and currenturl are the same, yet the script in the if statement is not get executed.
EDIT:
$(document).ready(function(){
var myurl = "http://domain.com";
var currenturl = window.location.href;
//alert(currenturl);
if (myurl === currenturl) {
alert('should see this');
} else {
}
});
SOLUTION:
$(document).ready(function(){
var myurl = "http://domain.com/"; // see the slash at the end
if (myurl == location.href) {
alert('that ss the same page');
} else {
}
});
Any suggestion? Thans.