Skip to main content

Bug Tracker

Side navigation

#9195 closed bug (invalid)

Opened May 09, 2011 03:14PM UTC

Closed May 24, 2011 04:55AM UTC

Calling on $('#<domID>') within an iFrame fails

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.next
Component: misc Version: 1.6
Keywords: Cc:
Blocked by: Blocking:
Description

I'm developing a Facebook app at the moment using jQuery 1.6. The facebook app interphace reequires that your app runs within an iFrame on facebook.

In this case, jQuery within the iframe fails to get DOM elements within the iFrame using $('#<domID>'), it returns null. My guess is that jQuery by default searches for dom elements at the parent level/top frame.

Example

<html>

<head></title>This is facebook</title></head>

<body>

<iframe src="http://example.com/yourapp.html">

<html>

<head>

<title>My App</title>

<script type="text/javascript">

$.checkDom = function()

{

alert($('#someobj')); // NULL

}

</script>

</head>

<body>

<input type="text" id="someobj" value="hello" onclick="$.checkDom()" />

</body>

</html>

</iframe>

</body>

</html>

Attachments (0)
Change History (2)

Changed May 09, 2011 03:22PM UTC by rwaldron comment:1

component: unfiledmisc
owner: → anonymous
status: newpending

would help if you actually included jQuery in your iframe doc

Changed May 24, 2011 04:55AM UTC by trac-o-bot comment:2

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!