Do you use external javascript?

taff's picture

They have: 956 posts

Joined: Jun 2001

I've been using external stylesheets for years but have never taken the leap with javascript (with the exception of dhtml modules0

I'm now asking myself: why not? I just tested things out by externalizing my menu rollovers and they work like a charm in 4 different browsers. Why haven't I been doing this before now?

Am I just a slave to routine or was there a valid reason that I'm forgetting?

.....

They have: 33 posts

Joined: Apr 2002

I'm gonna say slave to routine. You know the saying, "If it ain't broken, don't fix it."

taff's picture

They have: 956 posts

Joined: Jun 2001

aah, but you see, it is broken! and now I have to search and replace through a 40 page web site to fix all occurrences of it. Sad

Nope, I think it's high time I got dragged kicking and screaming into the 21st century Smiling

.....

They have: 117 posts

Joined: Feb 2002

I use external js files all the time, but one thing about them has always bothered me. If you do a view source in some versions of IE you only see the call to the js, not the html that gets generated by the js. I'm thinking that the navigation must be broken in readers as a result. I'm trying to get a meeting set up with a service that uses readers to check a site of mine, and that is one of the issues I've set up to be tested.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Quote: Originally posted by taff
aah, but you see, it [b]is broken! and now I have to search and replace through a 40 page web site to fix all occurrences of it. Sad

Nope, I think it's high time I got dragged kicking and screaming into the 21st century Smiling [/B]

I usually just have a header file that contains the head section and usually the navs. Then I just include this header file in the page. That way either external or internal JS, I only have to change it once.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

taff's picture

They have: 956 posts

Joined: Jun 2001

mairving: You are referring to server side includes? That is something else I'd like to delve into more. Two things prevent me from it..

1/ it is a pain in the neck to test on a local machine unless I run some sort of server setup

2/ quite often, either the client's host does not support ssi or it is an unknown factor at the time of the design

.....

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

I am talking about using PHP not SSI. You can set up an Apache server on your box with PHP/MySQL. I build all my pages on my local machine and then upload them.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Quote: Originally posted by mairving
I am talking about using PHP not SSI. You can set up an Apache server on your box with PHP/MySQL.

And that's easy! Even I could do it Smiling

Includes make life SO much easier that any kind of effort to check for host support would certainly be worth it. SSI or PHP... And I would assume that your host supports SSI unless you've got some crappy freebie deal.

openmind's picture

He has: 945 posts

Joined: Aug 2001

I must admit I only use JavaScript includes when I have a bit of script that is reused many times. Other times I just right the script straight in...

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: Originally posted by doublehelix
If you do a view source in some versions of IE you only see the call to the js, not the html that gets generated by the js.

No JavaScript is written to the file -- only server-side scripting is written to the file. JavaScript is always written to the browser/reader.

dk01's picture

He has: 516 posts

Joined: Mar 2002

Anyone use external Javascripts that are in a server parsed page?
for example:

<script language="Javascript" src="http://www.conxiondesigns.com/tools/counter.asp">
</script>
'
I used this to write server parsed javascript for pages that do not allow and severside languages. I have found that its pretty effective but I am not sure if it is looked apon as "bad practice" or anything. Any comments on this?
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.