更新的问题
我想要的是,每当您单击广告(链接)时,都会有一个“已单击”警报。
但是当我运行代码时,它说:
未捕获到的SecurityError:阻止了源为\“ null \”的帧 访问跨域框架。
请在此处http://jsfiddle.net/0pmofzty/23/检查代码
focus();
var parent = document.activeElement;
var iframe = document.getElementsByTagName('iframe')[0],
iframeDoc = iframe.contentWindow.document;
var targetLinks = iframeDoc.getElementsByTagName('a');
var listener = addEventListener('blur', function() {
if(document.activeElement === targetLinks) {
alert("clicked!");
focusParentEl();
}
});
function focusParentEl() {
iframe.blur();
parent.focus();
if(document.activeElement !== parent) {
setTimeout(focusParentEl, 500);
}
}
<div id="container">
<script>
ll_r = "phinoy";
ll_hc = "#545454";
ll_tc = "#545454";
ll_cc = "#e89d2b";
ll_dc = "#7f8091";
ll_w = "";
ll_nf = "0";
ll_nc = "0";
ll_nh = "0";
ll_nm = "0";
ll_np = "0";
ll_pa = "0";
ll_nt = "0";
ll_wt = "1";
ll_fw = "1";
ll_n = "6";
ll_cl = "";
ll_s = "w";
</script>
<script src="//www.leadsleap.com/w/js.js"></script>
</div>
此代码段很安全。我从另一个名为Leadsleap的广告公司那里获得了脚本,