I have a site I\'m working on. I need to be able to perform a specific function if the URL matches a specific URL. Here\'s an example of what I\'m trying to do:
If
Probably will be better to use the querystring location.search
than location.href
. This would cover subdomains/protocol changes.
if(location.search == "?l2=3,15,25")
$('.content').addClass('show');
You seem to be looking for the location object, which contains information about the URL of the current page.
var url = "http://www.example.com/EIFS-items/search.php?l2=3,15,25";
$(function(){
if (location.href==url){
$('.content').show();
}
});