Put Javascript and CSS In Their Own Files

Put Javascript and CSS In Their Own Files









I Heart AWeber.com

Do you love AWeber, too?

Put Javascript and CSS In Their Own Files

Some web developers embed Javascript code and CSS stylesheet info right in their web pages - either in the <HEAD> section, or near the top of their <BODY> section.

This is not a good idea. What I do these days is create a "js" directory in the document root and put all my .js files in there. I've been playing with Yahoo API's; a bunch of those files go in there too. Then you can "include" those files in your <HEAD> section with something like

<script type="text/javascript" src="/js/yourfile.js"></script>

Why? Because having too much junk in your <HEAD> (or in the top of your<BODY>) interferes with Search Engine Optimization. The search engines only really look at the first few kilobytes of a web page; so if there's no useful HTML content in there (because of too much stylesheets + javascript), you get a lower page rank.

If you want people to find your web site, don't make it difficult for the search engines to figure out what your pages are all about.



Bookmark and Share


Don't miss the latest web tips and tricks!
Subscribe to our low-volume mailing list:

Privacy Policy

See other tricks:  Web | Unix | Perl | SQL | General


Sample Sites | Customers | Our Team | Contact Us | Tips and Tricks | Tools | Our Network | Home

Copyright © 2006 Fastech Learning LLC, all rights reserved.
Phone toll free 1-866-464-6688, Phoenix Metro area 480-895-6688
Problem with this web site? please let us know