javascript - 相当于 FF 和 IE 中的 'window.location.ancestorOrigins'

标签 javascript google-chrome firefox internet-explorer-9 microsoft-edge

以下是用于从 iFrame 获取父窗口 URL 的 Google Chrome 版本。

window.location.ancestorOrigins;

我正在为 FireFox 和 IE 寻找与上述声明等效的内容。有没有可能实现。

尝试使用 document.referrer 也只提供 iFrame 网址。

最佳答案

不幸的是,FireFox 和 IE 没有与 ancestorOrigins 等价的东西。

关于获取父 URL,您可以做的最好的事情是 document.referrer 不幸的是,如果您正在处理 iframe,这意味着您可能无法访问外部页面并获得网页的真实 URL。

关于javascript - 相当于 FF 和 IE 中的 'window.location.ancestorOrigins',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34742800/

相关文章:

google-chrome - 用于 ICT4D 的 Chrome 应用离线安装程序

javascript - Firefox 后退按钮仅在第一次有效,第二次无效

javascript - css 上的子菜单悬停菜单问题

javascript - HTML5 文本字段的正则表达式模式

javascript - javascript的 `new Date()`使用什么系统调用?

javascript - 从 React Context API 渲染函数中的 map 函数渲染 HTML

css - Manipulate::selection 开发者工具中的伪元素

google-chrome - 丢失的 Chrome 标签,真的有些愚蠢的情况仍然可以挽救吗?

html - 在 Firefox 中居中图例

html - 使用带有 utf 8 的网络字体的 firefox 和 IE 中的特殊字符问题