dimanche 21 février 2016

javaScript if window.location.href contains url1 do not run else run it

I want to do not execute script if page url contains specific strings like url1 this is my code but it doesn't work!

var chick = window.location.href.indexOf('url1') == -1;
if (! chick) {
   // do something but don't do it if url contains url1
}

Aucun commentaire:

Enregistrer un commentaire