javascript - JQuery IF document url = "../products.html" Then do this -


how can document url , compare conditional branch?

pseudo code:

if document url = "../products.html" piece of code(); 

if working loaded html, can try

if(window.location.pathname == "products.html"){ //do here } 

location.pathname returns file name or path specified location.

in addition, can file name

var p = window.location.pathname.split("/"); var filename = p[p.length-1]; 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -