It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




7年前关闭。




我有一个使用window.location的javascript函数。它可以在Firefox和Internet Explorer中正常运行,但不能在Chrome中运行。我已经在Ubunutu Hardy和Windows Vista上对此进行了测试。潜在的问题是什么,如何解决?

最佳答案

window.location的最常见用法是使浏览器加载新页面。一个常见的错误是将URL分配给window.location对象,而不是其属性href。因此,正确的方法是:

window.location.href = 'http://www.guffa.com';

关于javascript - window.location在Chrome浏览器上不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2345807/

10-12 15:24
查看更多