Below is what I have.
var myString = \"http://localhost:8888/www.smart-kw.com/\"; alert(myString.indexOf(\"localhost\"));
This give me aler
I found a way to make this work:
(window.location.href).indexOf("localhost") > -1)
I actually use this for my projects as conditionals and it works just fine.