简体   繁体   English

window.open在IE8中不起作用

[英]window.open is not working in IE8

I am using IE8, to open a window i am using this code, 我正在使用IE8,正在使用此代码打开一个窗口,

window.open(url,"STO");

Its working in other browsers except IE8. 它可以在除IE8之外的其他浏览器中使用。

please tell me what is the problem with IE8? 请告诉我IE8有什么问题? I tried turningoff popupblocker also. 我也尝试关闭popupblocker。

FYI: I ran into this as well. 仅供参考:我也遇到了这个问题。 I was generating a PDF and then using window.open(url,'_blank') to open the PDF in a new window. 我正在生成PDF,然后使用window.open(url,'_ blank')在新窗口中打开PDF。 It worked fine in IE8 in Dev and Test but, in production, the window would just automatically open and then close. 在IE8中的开发和测试中,它工作正常,但是在生产中,该窗口会自动打开然后关闭。 I searched the net\\stackoverflow but did not find a solution that actually matched the problem. 我搜索了net \\ stackoverflow,但没有找到与问题实际匹配的解决方案。

It turned out that the link to the application on the client's intranet was via IP address instead of name. 事实证明,到客户端的Intranet上的应用程序的链接是通过IP地址而不是名称。 IE treats sites that addressed by IP as though they are in the internet zone even if they are actually on the intranet. IE将通过IP寻址的站点视为位于Internet区域中,即使它们实际上位于Intranet上也是如此。 I had the client's admin change the link and the pop up worked just fine. 我让客户的管理员更改了链接,弹出窗口正常运行。

I am sure there are security settings in the different zones governing this behavior but I would not want to make the Internet Zone settings less stringent. 我确定在控制此行为的不同区域中都有安全设置,但是我不想使Internet区域设置的严格程度降低。

I have tried with this code.And It worked perfectly for me . 我已经尝试过使用此代码。它对我来说效果很好。

var w =window.open(url,'_blank');
w.location.href = url;

if you are running the same code as you've shown here then let me tell you there is nothing wrong with the code. 如果您运行的代码与此处显示的相同,那么让我告诉您代码没有问题。 May be your pop up blocker is on try to turn it off and then try again. 可能是您的弹出窗口阻止程序处于打开状态,请尝试将其关闭然后再试一次。 You can turn it off by Tools->Internet Options-> Pricacy(tab)-> Uncheck popup blocker option. 您可以通过工具-> Internet选项->价格(标签)->取消选中弹出窗口阻止程序选项将其关闭。 Hope it helps 希望能帮助到你

Please check your URL variable 请检查您的URL变量

try this 尝试这个

window.open("goole.com", "google");

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

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