javascript create an iframe with strict doctype

前端 未结 2 1254
再見小時候
再見小時候 2021-01-05 12:04

I\'m building a widget that can be embedded in other sites. The widget is an iframe that is created using document.write() however I don\'t know how to apply th

2条回答
  •  余生分开走
    2021-01-05 12:54

    You could also use an HTML5 srcdoc attribute to specify your iframe's content.

    document.getElementById('myFrame').srcdoc = "

    You'll have to check if srcdoc is supported by your browser.

提交回复
热议问题