title: How to detect a click inside of an iframe (cross-domain)? Aka prevent click fraud
body: <p>I got a warning by my ad system provider about click fraud. No further info, all they are recommending is "hide the ads for users who click on ads too quickly'". I wrote a piece of JS script that hides all DIVs with ads for N seconds (using cookie) when clicked on, but this solution does not work as the "inner" content (with ads) is generated by an JS script that calls and renders the content from external server (as you would expect from an ad system). So, when one takes the cross-domain security into account it is kinda Catch 22. How can I detect a click inside a DIV (locally defined) of which content is rendered by an external JS and in iframe? </p>
  
  <p>Example:</p>
  
  <pre><code>&lt;div class="ad-class"&gt; &lt;!-- locally defined div --&gt;
     &lt;div id="my-id"&gt; &lt;/div&gt; &lt;!-- identifies my ad in the provider's system --&gt;
     &lt;script&gt;
        var foo = blah // declares the ad dimensions and stuff
        //  and renders the contextual ad in #my-id DIV
     &lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Were it all local, solution would be easy as the internal div would inherit the parent class ("ad-class"). In case of cross-domain, this is not valid. Any tips, dudes? </p>