2

我想达到这样的目标:

if(window.location.href.indexOf("http://stackoverflow.com/questions/")){
 ... then to this
}

但是当 url 看起来像这样时它仍然运行http://stackoverflow.com/questions/ask/

4

1 回答 1

17
if(window.location.href === "http://stackoverflow.com/questions/"){
    ... then to this
}
于 2012-05-11T19:48:22.513 回答