...

View Full Version : Using a shared html on website



Avik
01-03-2004, 02:27 PM
Hi,

My website has a top navigation bar with graphics and javascript codings - it weights about 60K.
I want to save it to a separate file in a way that every page can load it at the top, without using a frameset.
By doing that I hope to:
A. Allow browsers to cache the nav bar seperately = reduce loading time.
B. Update only one single file when necessary.

Is there some HTML technique for doing so?

Thanks,
Avik:confused:

Vladdy
01-03-2004, 02:48 PM
Images are cached separately, however if your navbar alone without images is 60K there is something terribly wrong with your code. While generally making your navigation depend on javascript is bad idea, you can put your script in a separate file which will also be cached on the first visit.

Skyzyx
01-03-2004, 04:49 PM
If you're going to do this, a server-side language would be the best way. Personally, I use PHP. I create a function that writes each line of code I need, and save it as a central library of sorts. On my individual pages, I simply load the library and call the function. This way, the processing doesn't depend on the user's computer... which is a drawback of using JavaScript, however, it can be done using the same ideas.

Requiring JavaScript just to have the page work introduces a flurry of accessibility, compatibility, and validation problems. Although it's possible to use JavaScript to do this, it is definitely not recommended.

oracleguy
01-03-2004, 05:04 PM
You could also use shtml instead of php if you just need the include functionality.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum