为什么 IE8 从 window.open 中删除 Uri 片段 (#myvar=1234)?
我在使用 Javascript 打开弹出窗口时遇到问题,该问题似乎只发生 在 IE 8 (8.0.7600) 中,
我试图 window.open 带有片段的 uri,例如:
http://davidlaing.com#UserName=CC735158
如果我将其粘贴到地址栏中;它工作正常(加载页面上的 JavaScript 可以访问 uri 片段)。
但是,如果我尝试从 javascript 打开相同的 uri:
window.open("http://davidlaing.com#UserName=CC735158",'','');
打开的窗口没有片段(也就是说,弹出窗口中的地址栏仅显示 http://davidlaing.com,并且加载页面上的 javascript 无法看到任何 Uri 片段)
相同的 Javascript 在其他浏览器(IE9、FF6、Chrome)中可以正常工作。我很确定它不是弹出窗口拦截器,因为窗口是“弹出”的,它只有一个没有片段的网址。
任何关于可能出现问题以及如何修复它的指示将不胜感激。
I have an issue opening a popup window using Javascript that only seems to occur
in IE 8 (8.0.7600)
I'm trying to window.open a uri with a fragment, eg:
http://davidlaing.com#UserName=CC735158
If I past this into the address bar; it works correctly (javascript on the loaded page can access the uri fragment).
However, if I try to open the same uri from javascript:
window.open("http://davidlaing.com#UserName=CC735158",'','');
the window is opened up without the fragment (that is, the address bar in the popup window shows only http://davidlaing.com, and the javascript on the loaded page cannot see any Uri fragment)
The same Javascript works correctly from other browsers (IE9, FF6, Chrome). I'm pretty sure its not the popup blocker, since a window is "popped up", it just has a url without the fragment.
Any pointers as to what might be wrong and how to fix it would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是您的 IE8 版本的问题。
我可以确认 IE 8.0.6001.18702 在 javascript window.open("http://davidlaing.com#UserName=CC735158",'',''); 打开时保留 URI 的哈希片段。
仅供参考:我使用了 XP IE6 VPC (http: //www.microsoft.com/download/en/details.aspx?displaylang=en&id=11575)并立即使用微软贴心留下的快捷方式升级到IE8 桌面。
It seems to be a problem with your build version of IE8.
I can confirm that IE 8.0.6001.18702 retains the hash fragment of a URI when opened in a javascript window.open("http://davidlaing.com#UserName=CC735158",'','');
FYI: I've used the XP IE6 VPC (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11575) and immediately upgraded to IE8 with the shortcut that Microsoft thoughtfully left on the desktop.