0

我正在尝试在不修改链接代码的情况下检索 iframe 内的任何点击 URL。我的目标是让用户在 iframe 正文之外单击 iframe 的 URL。我已经尝试了以下方法:

document.write(location.href);
document.write(window.location.href);
document.write(window.location);
document.write(document.URL);
document.write(document.location);
4

1 回答 1

0
document.getElementById("myFrame")
.contentDocument.addEventListener("click", yourfunction, false);

不要以为这可能只适用于来自同一的内容。

于 2013-08-25T23:36:34.577 回答