我正在尝试使用 javascript 设置 iframe 的内容。
我有 html 字符串。我正在写:-
var iframe = $('iframe')[0],
content = '<div>test</div>';
$(iframe).contents().find('html').html(content);
Run Code Online (Sandbox Code Playgroud)
它在谷歌浏览器中工作正常,但在火狐中显示内容一会儿然后消失。请帮我解决它。