Javascript function who return length of html?
Using Javascr开发者_StackOverflow中文版ipt, is there a way that I can determine the size of a document excluding any markup?
I think what you want is something like $(document).text().length
. It's not going to be completely exact, but it's going to be a good aproximation.
Here it is:
document.body.innerHTML.replace(/<[^>]*>/g, '').length
精彩评论