View Full Version : tracking mouse clicks in iframe with an external site

Oct 18th, 2009, 10:50 PM
I'm kind of new to javascript so forgive me for my ignorance.

Is their anyway to track right mouse click within an iframe that is linked to an external site (i.e. www.nbc.com)?

I'm trying to see if I can have a alert window say "This is an image" when i right click on an image within the iframe.

Old Pedant
Oct 19th, 2009, 06:51 AM
Yes and no.

You can put a transparent <div> overlaying the <iframe> (with a z-index higher than it) and thus catch the mouse movement and clicks. But your code has no possible way of knowing *WHAT* is inside the <iframe>. So you couldn't possibly detect where an image is within the iframe.