window.location 在 safari 上调用弹出空对话框
在网页上,我试图将浏览器重定向到同一站点上的另一个页面。 代码非常简单:
window.location = "/path1/path2"
在 safari 上 - 无论是 Windows 还是 Mac -
"http://domain.com"
都会出现一个仅包含文本的消息框。
我尝试了不同的方式来指定这一点:location.href、windows.assign(...) ...并且都具有相同的行为。
你们有人看到这个吗?你有解决办法吗?
谢谢。
on a web page i am trying to redirect the browser to another page on the same site.
the code is very simple for that:
window.location = "/path1/path2"
on safari - both windows as well as mac - a message box containing only the text
"http://domain.com"
comes up.
I have tried different ways of specifying this: location.href, windows.assign(...) ... and the all have the same behavior.
Did any of you see this? and do you have a solution for this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看这个问题。你应该使用:
take a look at this question. You should use:
感谢大家的帮助。
我发现了问题。在调用链中某处设置 window.location 之前,一个函数会发出 ajax 请求。
看来由于一些变化,请求现在比以前需要更长的时间。因此,如果在 ajax 请求期间更改位置,则会出现空消息框。
梅米。
thanks all for you help.
i found the problem. Before setting window.location somewhere in the call chain one function would make an ajax request.
It seem that due to some changes the request now takes longer then before. So if the location was changed during the ajax req., the empty message box would appear.
Memi.
你应该展示完整的代码。
例如,此错误代码
在单击时将显示 [OBJECT]。
如果你的脚本正好是
这样,那么还有其他事情发生 - 我刚刚在我的 Mac 上的 Safari 中测试了这个
you should show the complete code.
For example THIS bad code
will show [OBJECT] when clicked.
If your script is just
then there is something else going on - I have just test this in Safari on my Mac