How To

  Homes arrow How To arrow Two Ways To Optimize JavaScripts In Web Pages
 Webmaster Tools
 
Base64 Encoding 
Browser Settings 
CSS Coder 
CSS Navigation Menu 
Datetime Converter 
DHTML Tooltip 
Dig Utility 
DNS Utility 
Dropdown Menu 
Fetch Content 
Fetch Header 
Floating Layer 
htaccess Generator 
HTML to PHP 
HTML Encoder 
HTML Entities 
IP Convert 
Meta Tags 
Password Encryption
 
Password Strength
 
Pattern Extractor 
Ping Utility 
Pop-Up Window 
Regex Extractor 
Regex Match 
Scrollbar Color 
Source Viewer 
Syntax Highlighting 
URL Encoding 
Web Safe Colors 
Forums Sitemap 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HOW TO

Two Ways To Optimize JavaScripts In Web Pages
By: Developer Shed
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-08-09

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     

    SEARCH DEV MECHANIC

    TOOLS YOU CAN USE

    advertisement

    Two Ways To Optimize JavaScripts In Web Pages

    In this article I show you how to optimize your web pages by moving your JavaScript code out of the all-important top portion of the HTML file.

    JavaScripts are usually placed in between the <HEAD> section of a page, which pushes your body text containing your important keyword phrases further down the page.

    This can affect the number of keywords that search engine spiders index. It could also makes your keywords less relevant because they appear lower on the page.

    The solution is to move the JavaScript code away from the top portion of the HTML file. In fact, I will show you two solutions to resolving this problem.

    1. The first solution is to move the JavaScript code into a separate file and link to this file from the HTML file.

    This is the preferred solution because it:

    reduces your file size, and therefore your download time.

    allows you to reuse the code on other pages by simply linking to this file.

    Once you have move the JavaScript code to the new file, add the following code to the <HEAD>... </HEAD> portion of the HTML file:

    <SCRIPT LANGUAGE="JavaScript" SRC="file-name.js">
    </SCRIPT>

    You may replace "file-name" with any file name you like.

    Please note that external JavaScript files cannot contain any HTML tags. They must contain only JavaScript code.

    Some servers may not recognize the ".js" file type. If that is the case with your server, contact your web hosting company and ask them to add the following line to the "mime.types" file in the server's config directory, and then restart the server.

    type=application/x-javascript    exts=js

    2. The second solution is even simply. All you have to do is move the JavaScript code to the very bottom of the HTML file, below the </HTML> tag.

    Yes! It really does work! Although it is considered good programming practice to include your JavaScript within the <HEAD> portion of a HTML file, it isn't necessary.

    That's it! Simple isn't it? I highly recommend you use either of these two solutions to optimizing your web pages that contain JavaScript code.

    About The Author

    Michael Wong is a successful and respected search engine optimization specialist, and author of several search engine optimization books. Mike is also the Editor of Mike's Marketing Tools, the leading review site for the very best web marketing tools.

     

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More How To Articles
    More By Developer Shed

       

    HOW TO ARTICLES

    - Traffic Down One Month? Don`t Panic
    - How to Handle Fake Reviews
    - Facebook Game Update Tweaks
    - Facebook Profile Tweaks
    - How To Download Your Facebook Profile
    - Facebook Tips for Hiding Your Friends List
    - Facebook Tips to Avoid Unwanted Friend Reque...
    - Blog Contests: Do it Right
    - Simple Technique for Memorable Headlines
    - Understanding Your Analytics Results
    - Your Guide to Creating Quality Back Links
    - Getting Your True Ranking: Going Beyond Goog...
    - Optimizing for Google
    - The Right Way to Build Reciprocal Links
    - Monetization: How Not to Put Multiple Ad Ven...

    Developer Shed Affiliates

     



    © 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap