Javascript vs HTML (Which takes more time to load) -


what better off having lengthier javascript or lengthier html. few things- 1. don't care seo ratings. 2. care speed of site. 3. care functionality of web site.

basically question core coders- whats better -

<div> blah blah blah blah </div> 

or

document.getelementbyid("blah").innerhtml = "blah blah blah blah" 

? knowledge welcome :). thank you.

having browser render plain html faster having load javascript, wait dom ready, , use javascript manipulate dom.

even if ignore fact browser has more work when manipulating dom via javascript, think going take longer download:

30 characters:

<div>blah blah blah blah</div> 

or 50+ characters (too lazy count):

<script>     document.getelementbyid("blah").innerhtml = "blah blah blah blah"; </script> 

so going javascript route you're both downloading more content server , asking browser more work render page.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -