"Access is Denied" JS Exception - IE - No Ajax - Embd iframe

Feb 26, 2010 at 8:13 PM
Edited Feb 26, 2010 at 9:15 PM


 I was wondering if i was doing things correctly.  I currently have a canvas app which has a main page.  That main page contains an iframe of my own.  I've noticed that in order to check the session correctly, I have to pass all my facebook parameters from my main page to my iframe page. 

Question 1 ) Is this correct?  I'm assuming I need to just pass the QueryString that I recieve on the main page to the embedded iframe?

Now that that's done...it seems that for the most part, everything is working just fine;  Except when things timeout...let me explain a little bit more. 

My embedded pages all have different sizes, so on my embedded iframe (not the facebook canvas iframe) i have the function resize_iframe() which is pasted at the bottom.  In IE (testing Mozilla right now) if i let about 5 or 10 minutes go by, and then I try to click a link to reload the iframe...it seems that everything in window.frames throws an "Access is denied" exception.  sizeframe is the name of my iframe.  According to this page ... http://dev.fyicenter.com/Interview-Ques … n_.html... it means that I'm trying to run code on a different domain than what i'm currently on.  My links are of the following format "./Game/Home.aspx" + "?" + ClientQueryString, so I'm not sure how I could be running off a different domain.

Any help is appreciated.

In the end...I have a canvas page which contains the code to resize the iframe that is embedded on that canvas page.  when i click a new link on Default.aspx which looks like this...

<a href="./Game/Home.aspx?<%=ClientQueryString %>" onclick="initRefreshScreen(); document.getElementById('sizeframe').src=this.href; return false " > Home</a>

the iframe is loaded...

<iframe id='sizeframe' name='sizeframe'  ALLOWTRANSPARENCY="true" src='<%=GetCurrentIFramePage %>' width='750' height='700'  frameborder='0' scrolling='no' onload="resize_iframe(this);"></iframe>

and resize_iframe is called....

which calls...

resize_iframe onload.

Everything is within the current domain...but sometimes when i call window.frames["sizeframe"] i get an "access is denied" error.

The forums said there were problems with ajax.  I currently have some ajax extensions setup in my web.config, because creation of the project put them there, but I'm not using any ajax controls...I just have 1 aspx page embedded in another aspx page.  And it seems that this doesn't happen all the time, I usually have to wait a while after my session times out for this to happen.

Also, this is only happening in IE when i'm embedded within the facebook canvas....



function resize_iframe() {
                var element = document.getElementById("sizeframe");
                var frame = window.frames["sizeframe"];

                if (element && frame.name == "sizeframe") {
                    element.style.width = "750px";
                    element.style.height = "100px";
                    element.style.height = (frame.document.body.scrollHeight + 30) + "px";
                alert("IFrame resize access denied");