简体   繁体   English

JavaScript innerHTML.length替代

[英]JavaScript innerHTML.length alternative

Our application loads a huge HTML file in an iframe. 我们的应用程序在iframe中加载了巨大的HTML文件。 I know the size of the content already, so to check the download progress I am using innerHTML.length. 我已经知道内容的大小,因此要检查下载进度,我正在使用innerHTML.length。 Is there any alternative to count the number of characters loaded in an iframe. 是否有其他方法可以计算iframe中加载的字符数。

EDIT 编辑

The HTML file which is loaded in iframe is large(1.5 MB+) and is generated every time compilation process is done. iframe中加载的HTML文件很大(1.5 MB +),并且在每次编译过程完成时都会生成。 We would like to show the progress bar to users about the download progress and AFAIK in JavaScript there is no way to check download progress of JS (or resource) file(s), so I am using the content length of iframe to show progress bar. 我们想向用户显示有关JavaScript中下载进度和AFAIK的进度条,无法检查JS(或资源)文件的下载进度,因此我使用iframe的内容长度来显示进度条。

您还可以使用innerText.length ,这不是替代方法,而是另一种实现方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM