#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: |
Description
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(){
$("a#test").click(function(){
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>
Note: See
TracTickets for help on using
tickets.
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.