Bug Tracker

Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#4288 closed bug (invalid)

jQuery not working inside Facebook iframe-based application

Reported by: rafidka Owned by:
Priority: major Milestone:
Component: unfiled Version:
Keywords: Cc:
Blocked by: Blocking:

Description

Dear Sir/Madam,

I am developing a Facebook application using iframe. I want to use jQuery but I get the following error in IE (I do not get this problem in FF and Chrome):

"Access is denied"

on line 2945, which is this:

if (document.documentElement.doScroll && !window.frameElement) (function(){

After some tracing, I found that the source of the problem is trying to access window.frameElement, which is forbidden in IE (if the host of the iframe is different in domain) for security reasons. Please check this for more information.

http://w3schools.invisionzone.com/index.php?showtopic=5868 http://w3schools.invisionzone.com/index.php?showtopic=5782 http://www.webmaster-talk.com/javascript-forum/57656-cross-domain-problem-for-iframe.html

I would be very thankful if you let me know when you fix this bug. Here is my email address:

rafidka@…

Regards, Rafid

Change History (2)

comment:1 Changed 11 years ago by rafidka

I found a solution for this bug. I added the following code to to know whether we are in iframe or not:

var notInFrame = true;

try {

notInFrame = !window.frameElement;

} catch(ex) {

If accessing the frameElement fails, a frame is probably in a different

domain than its parent.

notInFrame = false;

}

Then later, I used this line:

if ( document.documentElement.doScroll && notInFrame ) (function(){

instead of this:

if ( document.documentElement.doScroll && !window.frameElement ) (function(){

This solved the problem. Please check this for more information: http://blogs.msdn.com/delay/archive/2007/02/05/safely-avoiding-the-access-denied-dialog-how-to-work-around-the-access-denied-cross-domain-iframe-issue-in-the-ajax-control-toolkit.aspx

comment:3 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.