SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    loading page function

    well i posted about it some time ago, and i got 2 answers
    1st answer: it says loading page until the page is really loaded which is what i wanted, but the problem here was that not the whole page was hidden. (u could scroll down with the mouse and see that the page content was not fully hidden)
    2nd answer: i choose how much time to set for this loading page msg to appear, but now i figured out its just not gonna work out, i got 5 pages with images in them and waiting around 7 seconds each time u go to a page will just make visitors run away.

    What i want is some function (in javascript or in ASP will do), that will make all of the page content hidden, until the page is fully loaded.

    Thanks in advance,
    Ulthane

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    If it takes 7 seconds for the page to be fully loaded, where visitors will run away, what benefit will it achieve to completely hide the page?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    it is fully hidden even now, but for 7 seconds always, no matter if ur browser will load the page in 4 sec or so...
    I did it because of the thumbnailviewer.js function, pple cannot enlarge images until the page is fully loaded (if they click on it before the page is loaded, it shows the image on a different page and then they need to go back to the previous page again, as well as waiting another 7 seconds...)
    i wanted at first to make it so when some1 click an image that wasnt fully loaded yet, it tells "Loading image" but i dont know how...

    so i just want to mimic the time needed for a page to be loaded, any function that will help achieving it will be perfect...

    Thanks in advance,
    Ulthane

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    I did it because of the thumbnailviewer.js function, pple cannot enlarge images until the page is fully loaded (if they click on it before the page is loaded, it shows the image on a different page and then they need to go back to the previous page again
    That must be one of the ancient scripts from dynamic drive.
    http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm

    By moving the script file to the end of the body, you can remove the onload delay, and run the init process immediately, which attaches the expected events on to the images before the page has finished loading.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Its not working, no matter where i put the script, it wont show the Loading image div at all, it just waits for the whole page to load and then when u click an image it'll enlarge it like it should do, if u do it before the page loads it'll take u to a different page...
    u can take a look urself at
    http://sospets.brinkster.net/dogs.asp

    Thanks in advance,
    Ulthane

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    Its not working, no matter where i put the script
    Moving the script is only one part of the solution.

    You should move your script to the end of the body, just before the </body> tag. Putting your script at the bottom is good best practice for speeding up your web site.

    Once you have done that, the script will be allowed to manipulate the document before it has loaded. You can then change the script so that instead of this:

    Existing script:
    Code javascript:
    thumbnailviewer.createthumbBox() 
    thumbnailviewer.dotask(window, function(){thumbnailviewer.init()}, "load") 
    thumbnailviewer.dotask(window, function(){thumbnailviewer.cleanup()}, "unload")

    You update the middle line to have the script do this instead:

    Code javascript:
    thumbnailviewer.createthumbBox() 
    thumbnailviewer.init();
    thumbnailviewer.dotask(window, function(){thumbnailviewer.cleanup()}, "unload")

    Now the links will load as you desire, even when people click on them before the page as finished loading.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    still the same problem :/

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    still the same problem :/
    Do you have a test page? The page that you linked to before appears to be unchanged.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    yes im testing from home atm which im changing
    Updated the new dogs.asp and thumbviewer.js files on brinkster now however if u wanna take a look

    Thanks in advance,
    Ulthane

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    yes im testing from home atm which im changing
    Updated the new dogs.asp and thumbviewer.js files on brinkster now however if u wanna take a look

    Thanks in advance,
    Ulthane
    The previous version of the page didn't work for me.
    This updated version of the page works for me.

    Make sure that your local web browser is seeing and using the updated version from the web site. Often your web browser will cache the previous version that uses to be there. If that's the case, Ctrl+F5 or Shift+F5 should force the new version to be loaded for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    it shows u the loading image msg when viewing an image? its still not working for me...
    i just tried to run it from brinkster aswell, doesnt show that msg there aswell,

    Maybe its a matter of what browser is being used...?

  12. #12
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    it shows u the loading image msg when viewing an image? its still not working for me...
    i just tried to run it from brinkster aswell, doesnt show that msg there aswell,

    Maybe its a matter of what browser is being used...?
    Possibly. I tried again and am told by Brinkster that your bandwidth has been exceeded.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #13
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    try at http://saharatias.brinkster.net/dogs.asp
    my daily bandwidth is limited to 17 mb

  14. #14
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    try at http://saharatias.brinkster.net/dogs.asp
    my daily bandwidth is limited to 17 mb
    Yep, working for me there too, but now exceeded too
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  15. #15
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    lol, ok ill check it with a few different browsers later to see what causes it,
    Thanks for all ur help

  16. #16
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    well i've just checked it with Firefox and IE, it doesnt work with any of them..

  17. #17
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ulthane View Post
    well i've just checked it with Firefox and IE, it doesnt work with any of them..
    I think that it's our internet speed that's proving the difference. I have a fast broadband connection. It takes only a few seconds for the page to load, but even then, when I click on the image as soon as it appears on the page, it still works for me.

    I suggest that we find someone else with a slow connection to carry on the testing.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  18. #18
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well yeah, thats it...
    tested on opera/safari/ie/firefox/chrome, on few of them it worked and on othes needed to wait around 3 seconds (in IE even more, too bad most of the pple are using IE :/) until the loading image msg appeared.

    Well i belive waiting a few seconds wont harm anyone, at least now the page doesnt need to be hidden for around 7 seconds every time a person loads it

    Thanks for all of ur support pmw57
    Ulthane


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
  •