Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12847 closed bug (duplicate)

It does not work click on iframe

Reported by: silviopy@… Owned by: silviopy@…
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();

});

Change History (3)

comment:1 Changed 11 years ago by gibson042

Owner: set to silviopy@…
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.

comment:2 Changed 11 years ago by karger

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.

comment:3 Changed 11 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.