How page load time affects with JavaScript?


Page load time gets affected with JavaScript files and code. If you are not optimizing JavaScript files then the page load time will increase, which shouldn’t happen. Minify the JavaScript code to decrease the page load time.

Also, cache JavaScript file for better results. For better performance, use inline and external JavaScript properly. Try to use external JavaScript file if you want to add the same script in multiple pages.

External scripts

  • The browser stores the external script once it is downloaded for the first time. If it is to be referenced again, then no additional download is needed.
  • This reduces download time and size.

Inline scripts

  • Inline Scripts are executed immediately.
  • It gets loaded instantly and there is no need to trigger another request.
  • Inline Scripts are more useful for server-side dynamic rendering.

Ali
Ali

Updated on: 03-Jan-2020

339 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements