Javascript window.open() 在 IE11 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27119867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 23:44:34  来源:igfitidea点击:

window.open() not working in IE11

javascriptinternet-explorer

提问by HookUp

I've searched many links for my query. But couldn't get the one I want. Am using in window.open(url, '_blank')in my script on click of button(am not using any html here, I want it to be on button click only). Its working in Chrome, IE8. I want to open a new tab in the same window in IE11. I don't want to do any settings in Internet Options of IE. Because the script has to work in every system, if I go with manual settings the script won't run in all the systems where ever I test. Is there any bug with IE11 ?

我为我的查询搜索了许多链接。但是买不到我想要的。用我window.open(url, '_blank')在我的按钮的点击脚本(我不使用任何HTML在这里,我希望它是只按一下按钮)。它在 Chrome、IE8 中工作。我想在IE11的同一窗口中打开一个新选项卡。我不想在 IE 的 Internet 选项中做任何设置。因为脚本必须在每个系统中工作,如果我使用手动设置,脚本将不会在我测试过的所有系统中运行。IE11 是否有任何错误?

采纳答案by prakashstar42

Window.open() itself opens in new tab, Just remove "_blank". Use the below code.

Window.open() 本身在新选项卡中打开,只需删除“_blank”。使用下面的代码。

window.open(url);

回答by Nayana_Das

window.open syntax is like :

window.open 语法如下:

window.open(strUrl, strWindowName, [strWindowFeatures]) 

So the second parameter is windowname, not the target sepcification.

所以第二个参数是windowname,而不是目标sepification。

Please refer this link

请参考这个链接