Skip to main content

Bug Tracker

Side navigation

#285 closed bug (worksforme)

Opened October 18, 2006 10:48AM UTC

Closed November 11, 2006 01:18PM UTC

Last modified December 04, 2009 08:30AM UTC

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>

Attachments (0)
Change History (2)

Changed November 11, 2006 01:18PM UTC by joern comment:1

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.

Changed November 13, 2006 02:17PM UTC by john comment:2

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