Javascript (JS) Code Optimization Techniques
by Vickram H[ Edit ] 2014-09-17 10:54:56
JS Optimization Technique:
1. Moving all .js files to footer of body tag <body>
2. And removing unwanted js files from index page.
3. Used when it needed for page.
Example:
Normal:
<html>
<head><script>.......</script> </head>
<body>
....
....
....
....
</body>
</html>
Now:
<html>
<head>...... </head>
<body>
....
....
....
....
<script>.......</script>
</body>
</html>
Advantages:
1. .JS will load after full page content loads.
2. User feel better when content loads first in low speed internet.
3. Loading symbol used for js loading if js file has more functions.