Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Welcome to the TechnoWorldInc! Community!
Recent Updates
[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]

[February 14, 2024, 02:00:39 PM]

[February 14, 2024, 02:00:39 PM]

[February 14, 2024, 02:00:39 PM]

[February 08, 2024, 10:26:18 AM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Programming Zone » Javascript
  Using External JavaScript Source Files
Pages: [1]   Go Down
  Print  
Author Topic: Using External JavaScript Source Files  (Read 1971 times)
Daniel Franklin
TWI Hero
**********


Karma: 3
Offline Offline

Posts: 16647


View Profile Email
Using External JavaScript Source Files
« Posted: September 29, 2007, 11:05:50 AM »


By now most web designers and developers know that JavaScript causes a real headache for search engine spiders.
There are however a number of scripts which, whilst not absolutely essential to the functioning of a site, are nevertheless very handy.

So where do you draw the line between keeping your page as search engine friendly as possible and including reams of JavaScript to achieve the desired effects?

You may be surprised to learn that there is an alternative which keeps search engine spiders (reasonably) happy whilst drastically cutting down on the necessary scripts within any given web page.

External JavaScript Source Files
Let's take the humble "Add Bookmark" script as an example (please note that I have replaced the < > brackets with [ ] brackets so as to be able to display the code properly within this article).

[script Language="JavaScript1.2" type="text/javascript"]
var bookmarkurl = "http://www.doodademporium.com";
var bookmarktitle = "Purple Doodads for sale";
function addbookmark()
{
if (document.all)
window.external.AddFavorite(bookmarkurl, bookmarktitle);
}
[/script]

By placing the script's function into an external folder and file (/java/bookmark.js for example) you will be able to streamline your code down to the following:

[script Language="JavaScript1.2" src="java/bookmark.js" type="text/javascript"][/script]

It's worth remembering that this is probably one of the simplest examples of JavaScript out there and that the savings in terms of code are going to be substantial with larger scripts.
This method is also worth its weight in gold, so to speak, if you are running a number of scripts on the same page.
Just remember to create a different source file for each script, so as not to confuse matters unnecessarily.

Through the use of external JavaScript files you not only save yourself having to write (or even copy/paste) the same bulky scripts again and again, you are also saving search engine spiders from becoming seriously disillusioned with your web page and going elsewhere in search of easier prey.

Always remember that any web site should make a search engine's life as easy as possible.
If you do use JavaScript in your pages, this approach will prevent unnecessary complications when having your site indexed, whilst at the same time easing your task of coding.

Articles Source - Free Articles

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.084 seconds with 24 queries.