Edge: Script70 error opening new window tab

北城以北 提交于 2019-12-07 12:18:29

问题


I am having an issue with Microsoft Edge browser (works fine on 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();. I have researched many similar issues with an iframe but have yet to find the cause of this error.


回答1:


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.

<!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.



来源:https://stackoverflow.com/questions/53504318/edge-script70-error-opening-new-window-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!