Reduce and Reuse Scripts
Optimize the use of scripts in your pages.
- Only have one JavaScript file. A single JavaScript file is easier and faster to load, but difficult to maintain.
- Remove redundancy. Don't use inline CSS or inline JavaScript. Inline CSS and JavaScript must be reprocessed every time the page is sent, unlike for pages that are cached with an external JavaScript or CSS file.
- Reuse JavaScript. The browser caches it and doesn't request it from the server.
Unobtrusive JavaScript
Using unobtrusive JavaScript can be better than extensive HTML markup. The page is smaller and the JavaScript is on the bottom, so the page renders faster.
Test DOM Modifications
If you modify the DOM on-the-fly, page loading performance could be negatively affected. If you must modify the DOM, test the performance with multiple browsers and browser versions