当我尝试使用jquery获取iframe的内容时,我得到了错误.请帮我解决

When i try get the content of iframe using jquery i am getting error.Please help me to solve

本文关键字:错误 解决 jquery iframe 获取      更新时间:2024-01-24

我使用了下面的脚本来获取iframe内容,但得到了

错误:访问属性"document"的权限被拒绝

jQuery("#"+iframe_id).contents().find("#widget-container").html();

您不能访问与父文档不在同一域上的文档的内容。这就是同源政策。