Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Preloading the next page?

  1. #1
    Join Date
    Aug 2006
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Preloading the next page?

    Hey guys,

    I'm looking to speed up the loading time of my sales letter. What I'm wondering is if there is some sort of script that will allow me to preload the second page of my site while visitors are viewing the first page, so that when they click to access the second page, it's already been loaded.

    For example...

    Visitor lands on page1.htm (meanwhile, page2.htm is "pre-loading" in the background)

    *visitor clicks on link to page2.htm*

    Page2.htm loads right away since it was already preloading while the visitor was on page1.htm.


    Any ideas??

    Thanks a bunch,

    Sean

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could put page 2 on page 1 like so:

    HTML Code:
    <iframe src="page2.htm" width="1" height="1" frameborder="0" scrolling="no" style="position:absolute;top:-3000px;left:-3000px;></iframe>
    You should place this tag either right after the opening <body> or right before the closing </body> tag of page 1.

    Other strategies you can consider are reducing the byte load of page 2 and/or preloading just its images.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2006
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply, I will give this a shot.

    Any advice on how to preload the images?

  4. #4
    Join Date
    Aug 2006
    Posts
    27
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I guess I could create a separate page using just all of the images, and use the same iframe strategy?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could use a javascript image preloader like so (goes in the head of the page):

    Code:
    <script type="text/javascript">
    function preload_page_images(){
    
    //Enter your images (and paths, if any) in the preloads array:
    var preloads=['image_1.jpg', 'image_2.jpg'];
    
    /////////// Stop Editing ////////////
    
    var loadem=function(im){
    var pimg=new Image();
    pimg.src=im;
    }
    for (var i_tem = 0; i_tem < preloads.length; i_tem++)
    loadem(preloads[i_tem]);
    }
    preload_page_images();
    </script>
    If you are doing this, as you propose, on a previous page, use:

    Code:
    onload=preload_page_images;
    in place of the red highlighted line. Preloading on the page itself will not save any time and is only good for preloading small rollover images.

    You could also do as you propose with the iframe. This would have the advantage of working even for folks who have javascript disabled.

    One thing that will help with or without preloading is optimizing your images. This is something that generally should be done for any page with significant image byte load.

    And, don't be fooled into thinking that preloading the page (I like the idea of preloading the whole page) or images will speed things up beyond the available bandwidth. By this I mean - say, it takes 5 minutes for a dial up user to load the images for your page. If you preload them on another page, this will save the full loading time for the user only if they stay on the preload page for its loading time plus the 5 extra preload minutes. This is why it is also important to reduce the overall image byte load.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You could use the technique suggested by jscheuer1 or i could help you write the ajax code which could do that.

    Just let me know if you'd need help from me.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Sparaker View Post
    You could use the technique suggested by jscheuer1 or i could help you write the ajax code which could do that.

    Just let me know if you'd need help from me.
    It seems to me that Ajax is overkill for preloading. Some browsers still do not support it, it cannot possibly speed up the process and, in fact may well slow it down.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    It seems to me that Ajax is overkill for preloading. Some browsers still do not support it, it cannot possibly speed up the process and, in fact may well slow it down.
    The advantage of ajax is that when you will click the link to the next page the javascript can instantly place the next page's content in place of the current page. And to my knowledge Ajax is supported in almost all the browsers except for the really really old versions.

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The advantage of ajax is that when you will click the link to the next page the javascript can instantly place the next page's content in place of the current page.
    ... nicely breaking navigational features such as history, bookmarks, and even the "back," "forward," and "up" buttons.
    And to my knowledge Ajax is supported in almost all the browsers except for the really really old versions.
    And all those with Javascript disabled.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Mar 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    ... nicely breaking navigational features such as history, bookmarks, and even the "back," "forward," and "up" buttons.And all those with Javascript disabled.
    disabling javascript is a users own choice. it doesn't mean that the browser doesn't support ajax.

Bookmarks

Posting Permissions

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