Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The following code will show you if the user click/hover or move out of the iframe:-</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Detect IFrame Clicks&lt;/title&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { var isOverIFrame = false; function processMouseOut() { log("IFrame mouse &gt;&gt; OUT &lt;&lt; detected."); isOverIFrame = false; top.focus(); } function processMouseOver() { log("IFrame mouse &gt;&gt; OVER &lt;&lt; detected."); isOverIFrame = true; } function processIFrameClick() { if(isOverIFrame) { // replace with your function log("IFrame &gt;&gt; CLICK &lt;&lt; detected. "); } } function log(message) { var console = document.getElementById("console"); var text = console.value; text = text + message + "\n"; console.value = text; } function attachOnloadEvent(func, obj) { if(typeof window.addEventListener != 'undefined') { window.addEventListener('load', func, false); } else if (typeof document.addEventListener != 'undefined') { document.addEventListener('load', func, false); } else if (typeof window.attachEvent != 'undefined') { window.attachEvent('onload', func); } else { if (typeof window.onload == 'function') { var oldonload = onload; window.onload = function() { oldonload(); func(); }; } else { window.onload = func; } } } function init() { var element = document.getElementsByTagName("iframe"); for (var i=0; i&lt;element.length; i++) { element[i].onmouseover = processMouseOver; element[i].onmouseout = processMouseOut; } if (typeof window.attachEvent != 'undefined') { top.attachEvent('onblur', processIFrameClick); } else if (typeof window.addEventListener != 'undefined') { top.addEventListener('blur', processIFrameClick, false); } } attachOnloadEvent(init); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe src="www.google.com" width="100%" height="1300px"&gt;&lt;/iframe&gt; &lt;br&gt;&lt;/br&gt; &lt;br&gt;&lt;/br&gt; &lt;form name="form" id="form" action=""&gt;&lt;textarea name="console" id="console" style="width: 100%; height: 300px;" cols="" rows=""&gt;&lt;/textarea&gt; &lt;button name="clear" id="clear" type="reset"&gt;Clear&lt;/button&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>You need to replace the src in the iframe with your own link. Hope this'll help. Regards, Mo.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload