[英]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?!?! 警报窗口将打开,因此条件为true ...但是浏览器不会重定向?!?!
Any thoughts? 有什么想法吗?
Depending on the browser you are using, window.location =
might be not enough. 根据您使用的浏览器,
window.location =
可能还不够。
Try to "full qualify" with window.location.href = "http://www.google.com";
尝试使用
window.location.href = "http://www.google.com";
“完全合格window.location.href = "http://www.google.com";
However, there is zero jQueryfication in that code :-) 但是,该代码中的jQueryfication为零:-)
window.location.href
是您要寻找的
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. 确保在浏览器重定向之前先看到此警报,否则,如果条件返回false。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.