Microsoft Edge browser javascript runtime "permission denied" error

6.5k views Asked by At

The following code to open a calendar in popup window, works in all browsers but got "permission denied" error in Microsoft Edge browser.

popupWindow.document.writeln("<HTML>\n<TITLE>"+ title +"</TITLE>\n<link href='calendar.css' rel='stylesheet' type='text/css'>\n<HEAD>\n" + js + "</HEAD>");

The code before this:

popupWindow = window.open("","CAL1","toolbar=no,location=no,status=no,
    menubar=no,scrollbars=auto,resizable=no,alwaysRaised=no,dependent=yes,
    titlebar=no," + strDims + ",left=" + xoffset + ",top=" + yoffset );

Anybody knows why this is happening?

2

There are 2 answers

0
unconnected On

It's because of Content Security Policy.

Shortly, you have to tell Edge to work unsecure from server side. https://docs.webplatform.org/wiki/tutorials/content-security-policy

Check other links here https://msdn.microsoft.com/en-us/library/dn904195(v=vs.85).aspx

2
Stefan Gehrig On

I think the problem here is the same origin policy. IE (and most likely Edge as well) probably considers a window opened with a '' (blank) URL as being in a different domain than the calling code. Try opening a blank HTML page for example instead of an empty URL.