Announcement

Collapse
No announcement yet.

Frequently used images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Frequently used images

    I have found this line of HTML code on another website and was wondering how it worked/wether it can be used to speed things up a little.

    <body onload="MM_preloadImages('../images/main/top_nav_o_04.gif','../images/main/top_nav_o_05.gif','../images/main/top_nav_o_06.gif','../images/main/top_nav_o_07.gif','../images/main/top_nav_o_08.gif','../images/main/top_nav_o_09.gif','../images/main/top_nav_o_11.gif','../images/main/top_nav_o_12.gif','../images/btn/btn_o_25.gif','../images/btn/btn_o_26.gif','../images/btn/btn_o_27.gif','../images/btn/btn_o_28.gif','../images/btn/btn_o_21.gif','../images/btn/btn_o_19.gif','../images/btn/btn_o_24.gif');loadCookie()">

    If i have usderstood this correctly 14 images would be downloaded in a cookie so that they can be used on every page instead of downloading the files each time a new page is loaded.
    Could someone correct me about this if i'm wrong or advise me about any other complications i might find if i used it.

    Thanks in advance

    Olly

    #2
    That's basically correct but they're not put in a cookie. They're simply loaded by the browser so that they are available from then on in the browsers Cache.

    The example above uses a bit of external JavaScript (from Dreamweaver I think) that you also need to include somewhere in your <HEAD> area.

    However Actinic has a built-in PreloadImages routine available, so all you need to do is edit Act_Primary.html and look for the fragment
    Code:
    OnLoad="NETQUOTEVAR:ONLOAD"
    and change it to
    Code:
    OnLoad="PreloadImages('myimage1.jpg','myimage2.jpg');NETQUOTEVAR:ONLOAD"
    You can add in as many images as you like.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks for your responce

      Can this be used for other files aswell? i.e. Flash files (.swf)

      Also if they are stored in the cache, are they updated often?
      The files wouldn't be updated often, once a month at the most.

      Olly

      Comment


        #4
        No, that's dangerous! Only valid image files can be preloaded this way.

        The JavaScript is creating dummy images and setting their source property to the passed in arguments.

        You might crash the browser by loading arbitary code into images!

        As to caching; all images and HTML get automatically cached anyway. SO these images will be treated no differently from other content.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          pre-loading is typically used for mouseover and other dynamic image swaps so there's no delay when the image is called for.

          For images in normal use there's no benefit to doing it this way. It would probably slow down the page as the images are preloaded before the page is displayed.

          Mike
          -----------------------------------------

          First Tackle - Fly Fishing and Game Angling

          -----------------------------------------

          Comment

          Working...
          X