Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using a shared html on website

    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

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You could also use shtml instead of php if you just need the include functionality.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •