#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:
Regards, Rafid
Change History (2)
comment:1 Changed 14 years ago by
comment:3 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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 {
} catch(ex) {
}
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