小编Dea*_*mon的帖子

在 Firefox 中使用 javascript 设置 iframe 内容失败

我正在尝试使用 javascript 设置 iframe 的内容。

我有 html 字符串。我正在写:-

 var iframe = $('iframe')[0],
 content = '<div>test</div>';        
 $(iframe).contents().find('html').html(content);
Run Code Online (Sandbox Code Playgroud)

它在谷歌浏览器中工作正常,但在火狐中显示内容一会儿然后消失。请帮我解决它。

html javascript iframe firefox jquery

2
推荐指数
1
解决办法
1277
查看次数

标签 统计

firefox ×1

html ×1

iframe ×1

javascript ×1

jquery ×1