简体   繁体   English

Window.open 在 IE 中不起作用

[英]Window.open not working IN IE

I have this function我有这个 function

window.open("<%=mcrforHyperLink%>&fromDate="+fromDate+"&interfacen="+interfacen+"&interfaceid="+interfaceid+"&toDate="+toDate,'name_' +Math.floor(Math.random()*11),'height=680,width=900');

This is not in IE, but working fine under Mozilla.这不在 IE 中,但在 Mozilla 下可以正常工作。

please help.请帮忙。

Internet Explorer can't handle window names that include a space. Internet Explorer 无法处理包含空格的 window 名称。 You don't have one, but I'd bet it also has problems when they include a .你没有,但我敢打赌,当它们包含. character (which you are generating with Math.random`).字符(您使用 Math.random` 生成)。 Make sure your name contains just alphanumerics.确保您的姓名仅包含字母数字。

Please explain why you are generating a random name for the window.请解释为什么要为 window 生成随机名称。 If you were to re-use it elsewhere I could understand.如果您要在其他地方重新使用它,我可以理解。

This will do exactly the same unless there is something I have missed除非我错过了什么,否则这将完全一样

window.open("...",'_blank','height=680,width=900');

(the... is your url) (...是你的网址)

Also please notice that most modern browsers may BLOCK your window open unless instructed otherwise.另请注意,除非另有说明,否则大多数现代浏览器可能会阻止您打开 window。 If the url is from the same domain as the page with the script, I suggest you ajax it into the page you are on.如果 url 与带有脚本的页面来自同一域,我建议您将 ajax 放入您所在的页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM