【问题标题】:Can't access content of iFrame because of Cross domain restriction由于跨域限制,无法访问 iFrame 的内容
【发布时间】:2014-01-21 03:29:45
【问题描述】:

我正在编写一个 google chrome 扩展程序来自动填写我的 eBay 帐户上的“留下反馈”表单。

当我运行我的扩展程序时,我在这个网站上: http://my.ebay.com/ws/....

在 iframe 中加载的网站具有以下格式: http://feedback.ebay.com/ws/....

当我尝试与 iFrame 交互时,我无法做到。

如何,请提供代码示例,我可以访问 iFrame 的内容,以便我可以执行此行

        frame.contentDocument.getElementsByClassName('radiopad')[0].getElementsByTagName('input')[0].checked = true;

如果您需要更多信息,请告诉我

【问题讨论】:

标签: javascript jquery html security iframe


【解决方案1】:

您无法访问它,因为它来自不同的域。见Same Origin Policy

【讨论】:

    猜你喜欢
    • 2014-08-02
    • 2014-03-16
    • 1970-01-01
    • 2013-08-03
    • 2013-03-05
    • 1970-01-01
    • 2011-12-17
    • 1970-01-01
    • 2020-05-04
    相关资源
    最近更新 更多