Welcome to WebmasterWorld Guest from 54.166.224.46

Forum Moderators: open

Message Too Old, No Replies

external .js file

Will a spider index this?

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

10+ Year Member



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();
</script>

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.

Regards,
Michael

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

10+ Year Member



hi dbdev,
so far i have not heard of external js files being indexed by
searchengines.
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:
[w3.org...]

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

10+ Year Member



PsychoTekk,

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?

Regards,
Mike.

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

WebmasterWorld Senior Member 10+ Year Member



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)

10+ Year Member



Thankyou all (learn something new every day).

Regards,
Mike.

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

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

WebmasterWorld Administrator buckworks is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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).
 

Featured Threads

Hot Threads This Week

Hot Threads This Month