边缘:Script70错误打开新窗口选项卡 [英] Edge: Script70 error opening new window tab

查看:88
本文介绍了边缘:Script70错误打开新窗口选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Microsoft Edge浏览器时遇到问题(在chrome,firefox,ie11上工作正常).

I am having an issue with Microsoft Edge browser (works fine on chrome, firefox, ie11).

代码:

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

我正在使用它来打开一个新标签页,对其进行写入并打印页面.在Edge中,我收到一个错误:Script70:win.document.open();上的权限被拒绝. 我研究了iframe的许多类似问题,但尚未找到导致此错误的原因.

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();. I have researched many similar issues with an iframe but have yet to find the cause of this error.

推荐答案

您的代码示例中有语法错误,您可以在任何浏览器的控制台中看到该错误.

You have syntax error in your code example which you can see in console in any browser.

您可以尝试修改您的代码,例如下面的代码将在包括MS Edge在内的所有浏览器上正常工作.

You can try to modify your code like below will work with all browser including 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>

注意:-将此代码复制到您的计算机上,然后尝试对其进行测试.如果您尝试使用stackOverFlow运行代码,则会给您一个错误.

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.

这篇关于边缘:Script70错误打开新窗口选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆