Skip to content Skip to sidebar Skip to footer

Permission Denied After Window.open() In Ie7

We have a winforms application with an embedded IE control. In this IE control, we run a web application (I control the web application but not the winforms application). In the we

Solution 1:

Based on:

  1. IE 6/7 Access Denied trying to access a popup window.document
  2. http://thecodecave.com/2006/07/20/how-to-get-around-access-is-denied-in-a-windowopen-javascript-call/

The problem you are having is that the Url being opened needs to be on the same domain as the page that is opening it. Presumably a blank Url will not share the domain of its creator. I wrote a couple of quick test web pages and found

  1. Calling var reportWindow = window.open('', newTarget, features); resulted in the access denied error.
  2. Same thing with var reportWindow = window.open('http://google.com', newTarget, features);
  3. But opening up another page in the site which does the rendering does work var reportWindow = window.open('WebForm2.aspx', newTarget, features);

This last one popped up a window pointing to WebForm2.aspx which executed this code:

window.document.open();
window.document.write('<head>\r\n<title>\r\n...\r\n</title>\r\n</head>');
window.document.write('test<bodystyle="height: 90%;">\r\n<tablestyle="height: 100%; width: 100%;"border="0">\r\n<tr>\r\n<tdalign="center"valign="middle"style="text-align:center;">\r\n');
window.document.close();

Post a Comment for "Permission Denied After Window.open() In Ie7"