Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#285 closed bug (worksforme)

Selecting $(window) with iFrame errors

Reported by: anonymous Owned by:
Priority: major Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:


If you try to use the $(window) selector on a page that contains an iframe with a source that is on another domain, the call will fail with error.

<html><head> <script language="JavaScript" type="text/javascript" src="jquery.js"></script> <script language="JavaScript" type="text/javascript" /> function breaktest(){


try {

$(window).name(); alert('passed');

} catch(e) {

alert(e); return false;



} </script> </head> <body onload="breaktest();"> <a href="" id="test">Test</a> <br /><br /> <iframe src="http://someothernonexistentdomain.com"></iframe> </body></html>

Change History (2)

comment:1 Changed 16 years ago by joern

Resolution: worksforme
Status: newclosed

You shouldn't use body onload=... with jQuery. Please check if it works when you use the standard $(document).ready(breaktest) event (or $(breaktest); as a shortcut).

If the problem lies within jQuery, reopen this ticket please.

comment:2 Changed 16 years ago by john

The problem was with jQuery - I resolved this in SVN, though.

Note: See TracTickets for help on using tickets.