I have a page which contains a Iframe. And i have opened an external website in that iframe.I want to capture the exact link which is clicked inside the iframe using pure Javascript. Below is my iframe code.
<iframe id = "frame" src="" name="iframe_a" width = 100% height = 100% style="border:none;""> </iframe>
var monitor = setInterval(function()
{
var elem = document.activeElement;
if(elem && elem.tagName == 'IFRAME')
{
elem.blur();
console.log(iframe_a.href);
//console.log("clicked");
}
}, 100);