Tuesday, 15 May 2012

html - Javascript get characters in documents including css and javascript -


I am looking to get the length of the entire document (in the form of str.length) and document any other file You can use . This question was helpful, but it only gives the characters of the current document, which does not take into account any linked JS or CSS files. Any suggestions?

This is completely pseudocode, but it should help you, however, guarantee the accuracy of length Impossible - due to variations in HTML coding, and how much depth it is with page-to-page linking.

This will also use junkie

  var length = 0; $ (Document) .ready (function () {// the length of the link you need (using the link above) = current document.lalig; // Repeat through each link / HREF / script. And the SRC $ (document) .find ("link"). (Function () {var attr = $ (this) .attr ("href"); // if it reaches a different server than your own , Then it will fail (attr! = Null) {$ .ajax ({url: attr, async: false, success: function (data) {length + = data. C;}}}}}};}  

No comments:

Post a Comment