【问题标题】:Get the content of the url opened in iframe [closed]获取在 iframe 中打开的 url 的内容 [关闭]
【发布时间】:2018-06-11 07:01:51
【问题描述】:

我在 iframe 中显示 url,现在我想获取在 iframe 中打开的网页的内容,任何人都可以帮助我。提前致谢

【问题讨论】:

标签: javascript html iframe


【解决方案1】:

如果你想操作 DOM 对象

var nestedObject = $(document.getElementById("iframe").contentWindow.document);

如果你只想要文字

document.getElementById('iframe').contentWindow.document.body.innerHTML

Cross reference to original post

【讨论】:

    【解决方案2】:

    获取 iframe 的 src 属性。

    var link = document.getElementById("yourIFrame").src;
    

    【讨论】:

    • OP 询问的是 url 的内容,而不是 url 本身
    • 误解了问题...
    猜你喜欢
    • 2012-04-16
    • 2011-03-03
    • 1970-01-01
    • 2020-08-14
    • 1970-01-01
    • 2023-04-10
    • 2012-08-20
    • 2010-10-18
    • 2017-03-02
    相关资源
    最近更新 更多