Place Scripts at the Bottom of Your Page

Posted by Pradeep on August 27, 2010
  0 comments

Placing JavaScripts at the bottom of the page  is a  good way to makeother things of the page download faster.

Keep in mind — the most important goal is to make the page load as speedily as achievable for the user. As soon as load script statement is encountered the browser tries to download and becomes unresponsive until the whole file has been loaded. Therefore, the user will have to wait longer before noticing some development or rendering in the page.

If you have JavaScript (JS} files whose only intention is to add functionality for example, after a button is clicked — go ahead and place those files at the bottom, just before the closing body tag.

Superior way

<p>MyContent</p>  

<script type="text/javascript" src="js/genral.js"></script>  

<script type="text/javascript" src="js/event.js"></script>  

</body>  

</html>  

 

Comments


Leave a comment

Tell us about yourself
Your Name     (required field)
Your Email Address     (required field)
Website URL      
Comment and preferences
Your Comment  
   
  Subscribe to this comment thread