Javascripts

Lawzilla's Newsletter
Keep Informed - Free
CA Employment & Business Law Updates
Private - unsubscribe anytime
Get Free Offers & Discounts
Email:
First Name:



OTHER
Lawyer Jokes


Two Ways To Optimize JavaScripts In Web Pages

Last Update: Friday, October 31, 2003.

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.

Internet marketing expert.About The Author: Michael Wong is a respected internet marketing expert, and the author of a leading search engine optimization guide, numerous marketing tips, and reviews of marketing tools and ecommerce software.
Publishing Rights: You may republish this article in your web site, newsletter, or ebook, on the condition that you agree to leave the article, author's signature and photograph, and all links completely intact. Full instructions on how to copy and upload my photo to your server.
LAWZILLA
HOME
MEMBER
ENTRANCE
for
PREMIUM
CONTENT
Bookstore
Sue Your Boss Law
CA expands lawsuits for violations of the labor code. New ebook has 100+ ways employers can be sued
Repair Your Credit
How to easily and effectively fix your credit report. Get the money, car, house and loans you need.



Search For:
Match:  Any word All words Exact phrase
Sound-alike matching
Dated:
  From: ,
 To: ,
Within: 
Show:   results   summaries
Sort by: 




Lawzilla home
Home to a Massive Amount of Information
lawzilla xml newsfeed XML Feed

Affiliate Program

Use of Lawzilla is subject to terms of use.
Legal advice is not provided.

Lawzilla
10824 Olson Drive, Ste. C # 146
Rancho Cordova, California 95670

© Copyright 1999-2008. All Rights Reserved.



Not find what you were looking for?


It might be in the premium members area!

We have also added a new service that tells us what keywords brought you here from a search engine. It is very informative, but somewhat frustrating. Here is why:

We will see your search term and realize that is not fully covered, or discussed at all, on our pages. We will then go and create information related to that search. Unfortunately, there is no way to contact you to tell you that what you were searching for has later been added to Lawzilla.

Feel free to send us an email to let us know what you are searching for so that we can reach you. Please confine the issues to California law, and keep in mind that while some issues can be addressed quickly, others may be extremely complicated requiring much research before the new information can be added, and this is not a substitute to retaining an attorney to discuss your situation. Please send your searches to:



[an error occurred while processing this directive]