开发者

Why does this not cause a browser redirect?

if (selectedddItem.toString().indexOf("6ft with two") > -1) {
  window.location = "http://www.google.com/开发者_运维技巧";
  alert("just passed over");
}

The alert window opens so the condition is true... however the browser doesn't redirect?!?!

Any thoughts?


Depending on the browser you are using, window.location = might be not enough.

Try to "full qualify" with window.location.href = "http://www.google.com";

However, there is zero jQueryfication in that code :-)


window.location.href

Is what you are looking for


Have your code like this:

if (selectedddItem.toString().indexOf("6ft with two") > -1) {
  alert("just passed over");
  top.location.href = "http://www.google.com/";
}

Make sure you are seeing this alert first before browser redirect otherwise your if condition is returning false.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜