homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

external .js file
Will a spider index this?

 3:32 pm on May 17, 2003 (gmt 0)

Hi all,

If I have a PILE of java sript in an external file ie x.js, which is called from my html code via:

<script language="JavaScript" src="x.js"></script>

<script language="JavaScript">myFunctionFromJsFile();

Will a spider travel to x.js and try to index what it finds in there or will the spider only see the code within the html file itself.

I am new to seo and am trying to learn how to minimize my html code size.




 3:41 pm on May 17, 2003 (gmt 0)

hi dbdev,
so far i have not heard of external js files being indexed by
just html files, pdf files etc contain "actual content", js files
mainly contain code.
btw, you should use
<script src="x.js" type="text/javascript"></script>
instead of
<script language="JavaScript" src="x.js"></script>

here's a link:


 5:48 pm on May 17, 2003 (gmt 0)


First off, thankyou for answering my question and for the code advise. Secondly, why would anyone want to hide their java script and/or include external .js files as opposed to just embedding all the java code within the html code, if a spider is not going to index it anyway?



 5:54 pm on May 17, 2003 (gmt 0)

Spiders like to see lean html without a lot of coding overhead. Also, most SE algo's will place more weight to keywords which are found near the top of the document. Putting your js code in an external file keeps the html size to a minimum.


 6:05 pm on May 17, 2003 (gmt 0)

Thankyou all (learn something new every day).



 6:16 pm on May 17, 2003 (gmt 0)

Putting your js code in an external file keeps the html size to a minimum.

The other major benefit of using external files is now you can control all of your javascript with one file. If it were on page and was used throughout the site, anytime you make a change, you need to use the find and replace routine.


 6:22 pm on May 17, 2003 (gmt 0)

External .js files have even more advantages if you use the same file on multiple pages. One advantage is easier site maintenance, because updates to the .js file(s) will be reflected throughout the site.

Another advantage is that visitors will experience faster page loads as they move around your site. The first time they view a page that includes the file, the loading time will be whatever it needs to be, but subsequent pages will load a bit faster because the .js file will already be in cache.

I like external .js files for things like drop menus, newsletter signup boxes and search boxes that appear on multiple pages. Try to provide an alternate path to the information contained in the .js files for the benefit of users surfing with javascript turned off.


 3:37 am on May 18, 2003 (gmt 0)

My vote is for the modularity/re-use argument, not Search Engine effectiveness. If it is not common for spiders to look at js now, it will be soon, because they need to check that the js is not doing something like:

document.<whatever>.style.visibility = "hidden";


 8:54 am on May 18, 2003 (gmt 0)

The modularity, code re-use, cache usage, speed of loading, etc, arguments for external javascript files can be equally applied to external CSS files as well; and we take it for granted that images are not embedded into the HTML (but the same reasons have always applied there too).

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved