Note that there are some explanatory texts on larger screens.

plurals
  1. POIE9 "permission denied" on an xml document which was created by a frame which no longer exist
    primarykey
    data
    text
    <p>I came into a really strange situation. I have the following setup:</p> <p>Parent window has an object "bar" which includes an xml document and few other properties:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; var foo=null; //used in most report pages var bar=function(document, boo){ this.doc=document; this.boo=boo; this.baz="serge"; }; &lt;/script&gt; &lt;head&gt; &lt;body&gt; &lt;iframe src="_child1.html"&gt;&lt;/iframe&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>First child frame loads a simple xml file by ajax:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="../lib/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $.ajax({ url: "books.xml", type: "get", dataType: "xml", success: function(data) { var boo = { name: "boo" }; parent.foo = new parent.bar(data, boo); alert(parent.foo.boo.name); alert(parent.foo.baz); alert(parent.foo.doc.firstChild.nodeName); window.location = "_child2.html"; } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; child1 &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The XML is:</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;bookstore&gt; Vaidyanathan Nagarajan &lt;/bookstore&gt; </code></pre> <p>On success it creates a "bar" instance in the parent window and stores it in the "foo" variable which again resides in the parent window. </p> <p>Then it outputs those properties (successfully) and redirects to a second child frame.</p> <p>Second child frame tries to access the "foo" object in the parent frame and output its properties:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="../lib/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; alert(parent.foo.boo.name); alert(parent.foo.baz); alert(parent.foo.doc.firstChild.nodeName); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; child2 &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And now the interesting stuff happens: in FF and Chrome we see the 3 properties fire two times: once in _child1 and secondly in _child2. In IE9 however, we see only 5 alerts! </p> <p>And the reason for this is that <code>parent.foo.doc</code> throws "Permission denied" for some reason.</p> <p>I believe that the reason is that somehow IE "remembers" that the xml document was created in the first child frame (perhaps for performance reasons) and when the second child frame tries to access that object IE isn't able to find it (or stores it in a restricted memory stack).</p> <p>Furthermore, when I tried this scenario <strong>without</strong> redirecting - just putting those two child frames in the parent frame together - the second child frame had no problem accessing the parents' xml doc.</p> <p>One workaround could be to clone those xml documents inside the "parents" before assigning, but we have many scenarios like this and first I would like to ask whether someone has a better idea?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload