Execute javascript if current location contains html in in. I have tried the below but it doesn't work
var winloc = window.location; //for e.g http://mysite.com/home.html
var ishtml = winloc.match(/html/$);
var dothtml = "html";
if(dothtml==ishtml){
//execute javascript here
}
See Amaan answer using regexp:
https://stackoverflow.com/a/8619635/887539
Demo
My suggestion:
You don't have to declare local variables if the value are only needed once...