Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Putting Javascript Code In A Separate File
#1
Posted 02 August 2003 - 09:58 PM
I read as one of the tips to put the javascript code in a separate file and not in the head of the document.
I just started doing external scripts and SSI, and I thought that even though my code says <!-- include file... -->, when I view the source code online, all the code from the external file is put into the file I am viewing, so doesn't that defeat the purpose since the code ends up being there anyway?
Thanks,
Risa
#2
Posted 02 August 2003 - 10:10 PM
SSI is server side includes- meaning the page is built (parsed) by the server and delivered fully coded to the browser.
It's different than javascript code which is called and processed but not actually written on the page.
Hope that helps!
#3
Posted 02 August 2003 - 10:10 PM
But in the case of calling a style sheet or a script, it does not get written into the page by the server. Instead the browser goes out and grabs it as soon as it hits the code that calls it. Moreover, the script (or the style sheet) then gets cached, so any additional pages that use them will load faster.
#4
Posted 02 August 2003 - 10:24 PM
We must have hit the submit button at the same time.
#5
Posted 02 August 2003 - 10:26 PM
#6
Posted 03 August 2003 - 01:23 AM
You can reference the javascript by refering to a *seperate* file named whatever.js This file would contain the javascript required by your various function calls.
<head> <script language="JavaScript" src="whatever.js"> </head>
So, instead of having multiple lines of javascript in the head of your document, you just have the one. Thus reducing your page size.
#7
Posted 07 August 2003 - 02:01 PM
I've been running javascript in the head of documents for a looong time...never had any problems with engines..if that's what your concern is. I've run single and multiple head scripts also without anything unusal happening.
Take Care!
#8
Posted 07 August 2003 - 02:15 PM
(We don't know if it really parses them, but we don't know what else it would be doing with them...)
#9
Posted 07 August 2003 - 02:21 PM
#10
Posted 07 August 2003 - 08:21 PM
I've tried all day to get my external JS file to work, to no avail. I don't really know how to write javascript. My pull down menu was generated using Fireworks.
I'm doing this so that spiders can crawl my site more easily without going through all that code. I got this tip from a posting here.
How important is this? I really feel like giving up trying to do this external js file, but if it's really important, maybe I'll pay a js coder that I know to make it work for me.
What do you think? Thanks.
Risa
#11
Posted 07 August 2003 - 08:32 PM
Well, I've been running scripts in all of my pages for years without any Engine problems, I run 2 corporate websites that rank in the top 10 (pharmaceutical industry) with scripts intact. I wouldnt worry about using scripts in the head or body of your pages.
Take Care!
#12
Posted 07 August 2003 - 09:47 PM
It's just a nice thing to do. Makes the file size smaller, makes it apparently easier to find "the meat."
But it's absolutely not something that is critical to your search engine rankings, contrary to what you may have heard!
But, a reminder: Google can now index external .js files, so don't hide anything in there for whatever reason.
(We don't know if it really parses them, but we don't know what else it would be doing with them...)
My guess is this is simply GoogleGuy propaganda to scare people into not trying to trick them through their javascript.
Sad that people need to be threatened in order not to use tricks though.
Jill
#13
Posted 08 August 2003 - 01:39 AM
Sad that people need to be threatened in order not to use tricks though.
This is one thing that I just cannot fathom at all in the SEO industry. SEO to me is so fascinating trying to stay ontop & ahead of the game (as long as its done ethically) ; I love the challenge it brings & still feel the thrill of reaching top 10 rankings with every new project (or even page) launched!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users








