It isn't possible to write into a document from an asynchronously-loaded


It isn't possible to write into a document from an asynchronously-loaded

今天遇到了一個問題:

通過document.write() 輸出一個iframe 標簽的時候 提示錯誤

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. 

在chrom上面就提示”Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened. “

 

解決方法  

var iframeStr = document.createElement('iframe');
document.getElementsByTagName('body')[0].appendChild(iframeStr);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM