Does anyone have a good method for adding an onClick event to an iFrame? I've tried searching around for some solutions online and none of the solutions I found have worked for me. And setting the onClick of the body doesn't execute the function nor does just setting it for the iFrame itself
You would need to use jQuery for this but I think it should help you: https://github.com/finalclap/iframeTracker-jquery
since the contents of an iframe are actually a browser window sitting OVER the host content, you shouldn't be able to trap onclick over it at all in ANY browser. "Just not allowed " for a whole host of security reasons. Though again, this is 2013, not 1998 -- why are you even trying to use iframes in the first place?
If you have access to the iframe codebase, then there are several ways you can implement communications between the child and parent. A really nice way to do so is by creating a proxy on each site that relays the information back and forth. There were other solutions like using flash overlay, which isn't 100% perfect but works on double clicks. The issue here is mainly same origin policy, where your script needs to be on the same TLD as the site it includes if you want to access/modify it.