Skip to main content

Bug Tracker

Side navigation

#12847 closed bug (duplicate)

Opened November 05, 2012 12:39AM UTC

Closed November 17, 2012 01:37PM UTC

It does not work click on iframe

Reported by: silviopy@outlook.com Owned by: silviopy@outlook.com
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:
Description

I tried a piece of code with iframe and I found this:

$("#iframeID").load(function(event){

$(this).contents().find('#myid').click();

});

this does not work, however this if:

$("#iframeID").load(function(event){

iframeName.document.getElementById('myid').click();

});

Attachments (0)
Change History (3)

Changed November 05, 2012 02:50AM UTC by gibson042 comment:1

owner: → silviopy@outlook.com
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed November 17, 2012 05:15AM UTC by karger comment:2

I've created an example here:

http://people.csail.mit.edu/karger/Scrapelet/Dev/test.html

I can't figure out how to put it into jsfiddle because it involves loading three different pages linked to each other.

To clarify the original bug report: if elt is an anchor element inside an iframe, then invoking the (native) elt.click() method successfully simulates a user click and triggers navigation to the link target (at least on firefox and chrome), but invoking jquery's $(elt).click() does NOT successful navigate to the link target. Tracing jquery's 1.8.3 source code reveals that at line 2955 jquery is carefully choosing *not* to invoke the native click method---I'm not sure why.

Changed November 17, 2012 01:37PM UTC by dmethvin comment:3

resolution: → duplicate
status: pendingclosed

Duplicate of #12652.> Tracing jquery's 1.8.3 source code reveals that at line 2955 jquery is carefully choosing *not* to invoke the native click method---I'm not sure why.