简体   繁体   English

Edge:Script70错误打开新窗口选项卡

[英]Edge: Script70 error opening new window tab

I am having an issue with Microsoft Edge browser (works fine on chrome, firefox, ie11). 我遇到了Microsoft Edge浏览器的问题(在chrome,firefox,ie11上运行正常)。

Code: 码:

    let win = window.open('', 'testWindow');
    win.document.open();
    win.document.write(var);
    win.document.close();

I am using this to open a new tab, write to it and print page. 我正在使用它来打开一个新选项卡,写入它并打印页面。 In Edge i am getting an error: Script70: permission denied on the win.document.open(); 在Edge中我收到一个错误:Script70: win.document.open();上的权限被拒绝win.document.open(); . I have researched many similar issues with an iframe but have yet to find the cause of this error. 我已经用iframe研究了许多类似的问题,但还没有找到导致此错误的原因。

You have syntax error in your code example which you can see in console in any browser. 您的代码示例中存在语法错误,您可以在任何浏览器的控制台中看到该错误。

You can try to modify your code like below will work with all browser including MS Edge. 您可以尝试修改您的代码,如下所示将适用于所有浏览器,包括MS Edge。

 <!doctype html> <head> <script> var myWindow = window.open("", "TestWindow", "width=200,height=100"); myWindow.document.write("<p>Hello World</p>"); //myWindow.close(); </script> </head> <body> </body> </html> 

Note:- copy this code to your machine and than try to test it. 注意: - 将此代码复制到您的机器上,然后尝试测试它。 If you try to run the code with stackOverFlow than it will give you an error. 如果您尝试使用stackOverFlow运行代码,则会出现错误。

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

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