[英]How to get the url when any link is clicked in Iframe?
我试图在iframe中检索任何点击的网址,而不修改链接的代码。 我的目标是获取用户在iframe主体外部的iframe中点击的网址。 我已经尝试了以下方法:
document.write(location.href);
document.write(window.location.href);
document.write(window.location);
document.write(document.URL);
document.write(document.location);
document.getElementById("myFrame")
.contentDocument.addEventListener("click", yourfunction, false);
但这并不是只适用于同一域中的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.