|external .js file|
Will a spider index this?
If I have a PILE of java sript in an external file ie x.js, which is called from my html code via:
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.
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
here's a link:
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?
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.
Thankyou all (learn something new every day).
|Putting your js code in an external file keeps the html size to a minimum. |
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.
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";