是否有任何理由使用 (window.)top 通过 JavaScript 引用当前窗口?

发布于 2024-11-14 12:03:19 字数 248 浏览 0 评论 0原文

我目前正在尝试在内部网站的 iFrame 中显示第三方网站。它们都位于同一个二级域上。

第三方网站使用一些 JavaScript 脚本,这些脚本使用 top 和 window.top 来引用当前窗口。

除了阻止脚本在框架中工作之外,还有什么原因吗?

第三方实际上表示他们将支持在 iframe 中显示网站。

除了 top 的引用之外,在 iFrame 中查看网站时是否还会出现其他与 JavaScript 相关的问题?

I am currently trying to display a third-party website in an iFrame on an internal website. They are both located on the same second-level domain.

The third-party website uses some JavaScript script which use top and window.top to reference to the current window.

Could there be any reason for this except to prevent that the scripts work in an frame?

The third-party actually said they would support the displaying of the website in an iframe.

Could there be any other JavaScript related problems when viewing a website in an iFrame besides a reference with top?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖正好 2024-11-21 12:03:19

使用 top 没有其他原因,只是为了打扰那些构建它们的网站。

也许是遗留代码在框架集 html 中具有实际代码。

iframe 的其他问题可能是使用后退和前进按钮导航以及使用 window.xxx 语句时拒绝访问

There is no other reason for using top than to bother sites that are framing them.

Perhaps it is legacy code that had the actual code in the frameset html.

Other issues with iframes could be navigation using back and forward buttons and access denied when using a window.xxx statement

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文