gpt4 book ai didi

jquery - 如何将外部样式表和 javascript 导入 iframe

转载 作者:技术小花猫 更新时间:2023-10-29 11:12:47 25 4
gpt4 key购买 nike

我只想将外部样式表和 js 导入到 iframe 的 head 标记中。可能吗?

我已经在 html head 中尝试了一个自定义的 jquery 函数 `

$(this).contents().find('head').append('<link href="http://mywebsite.com/css/iframe.css?" rel="stylesheet" type="text/css" />')`

最佳答案

iframe 中的 window 对象是加载到 iframe 中的页面的属性。包含页面操作 iframe 窗口对象的唯一方法是包含页面和 iframe 页面的域是否相同。 (由于跨域限制政策)

关于jquery - 如何将外部样式表和 javascript 导入 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14457474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com