Delayed Redirect Script for Image Hosting site

Discussion in 'JavaScript' started by lostgot, Oct 30, 2008.

  1. #1
    Im Currently looking for a script which dealys the opening of the Image page by 5 seconds.

    Example:
    A user clicks on the thumbnail of the image---->The Landing page must show "Please wait while the image loads......" ------>(after 5secs)--->Opens the original full size image page.

    How can this be done..?
     
    lostgot, Oct 30, 2008 IP
  2. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #2
    you must have a function that redirects. An example :

    function redirect(reference) {
    // replace with your view image file 
    location.href = 'image.php?id='+reference
    }
    
    function delayed_redirect(reference) {
    setTimeout('redirect(reference);',5000) // 5000 milliseconds = 5 secs
    }
    
    HTML:
    in your file that display the image:
    
    <img src="link_to_image.gif" title="Thumbnail of bla bla" onclick="delayed_redirect(REFERENCE_TO_YOUR_PICTURE)" />
    
    HTML:
    The REFERENCE_TO_YOUR_PICTURE may be the picture's ID? or anything that you need to tell your scripts to display the image.
     
    ads2help, Oct 30, 2008 IP
  3. VishalVasani

    VishalVasani Peon

    Messages:
    560
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Javascript Function setTimeout Is useful for You....
     
    VishalVasani, Oct 30, 2008 IP
  4. oxidati0n

    oxidati0n Peon

    Messages:
    744
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Usually setTimeout() is common for javascript but a majority of people who don't have javascript meaning you'd have to use <meta http-equiv='refresh'...> for your <noscript>. I know this is irrelevant for javascript, but it's useful to have support for people who don't use javascript because there is a LOT of negatives for javascript.
     
    oxidati0n, Nov 1, 2008 IP