简体   繁体   中英

Edge: Script70 error opening new window tab

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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