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:
- IE 6/7 Access Denied trying to access a popup window.document
- 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
- Calling
var reportWindow = window.open('', newTarget, features);
resulted in the access denied error. - Same thing with
var reportWindow = window.open('http://google.com', newTarget, features);
- 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"