Is it possible to track a button click within an iFrame if i don’t have control over the external website or it’s contents?
(very fictionnal example)if i had an iframe like this:
<iframe src="http://www.johnny.com/plugins/like.php?href=http%253A%252F%252Fexample.com%252Fpage%252Fto%252Flike&layout=standard&show_faces=true&width=450&action=like&font&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
If you are asking whether you can find a button in the DOM of the HTML that has your iframe and then add an onclick event to it, then yes, if you are served from the same domain.
will work — so will any other DOM functions.
If you are not on the same domain, then the browser won’t let you. It’s called cross-site scripting (XSS) and is considered a security violation.
If you are on another domain, the owner did add your iframe, right? If so, have them also add in the events. They can pass in variables and call helper functions on your iframe. So they could pass the button in and you could add the event to it.