1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to increase loading time?

Discussion in 'HTML & JavaScript' started by Sprouts, Oct 29, 2010.

  1. Sprouts

    Sprouts Regular Member

    Joined:
    Mar 20, 2010
    Messages:
    461
    Likes Received:
    324
    Ok this may sound like a weird question but I want my site to never fully load...

    i.e. the page loads and the user can see the page content but the page never loads and therefore appears to be loading all the time.

    is there some way to do this by adding some sort of script that either takes a long time to load or keeps attempting to load (e.g. a loop function).

    Thanks
     
  2. n2zen

    n2zen Regular Member

    Joined:
    Sep 27, 2009
    Messages:
    269
    Likes Received:
    70
    Have you considered putting a small iframe in the page, asking it to load another page, then in that other page simply put a refresh with a really long time in it?

    Code:
    HTML META command can be used to instruct the browser to wait specified seconds and then load the web page. This is the code, which can be used to accomplish this requirement:
    <META HTTP-EQUIV="REFRESH" CONTENT="X;URL=MyWebPage.html"> Change the X to the number of seconds you want to wait before MyWebPage.html is loaded. MyWebPage.html is the HTML page intended to be loaded. This page address can be expressed as either a relative or an absolute URL. Remember that all META commands must be placed in the HEAD section of the HTML code, or somewhere between the <HEAD> and </HEAD> tags.
    
     
    • Thanks Thanks x 1
  3. disaffected

    disaffected Junior Member

    Joined:
    Nov 9, 2008
    Messages:
    137
    Likes Received:
    47
    Could you throw an infinite loop in right before the closing body tag? I tried a quick test and the result depends on the browser. Some give a slow script warning. Depends on exactly what you need I suppose.

    Code:
    <script>
    while(true) {
            var a = '';
    }
    </script>
     
    • Thanks Thanks x 1
  4. thedorf

    thedorf Senior Member

    Joined:
    Oct 1, 2008
    Messages:
    1,193
    Likes Received:
    700
    Occupation:
    what? I gotta have a job?
    Location:
    BHW - Where else?
    You could play with outputing data and then doing something like this:

    Code:
    <?php
    
    // sleep for 10 seconds
    
    sleep(10);
    
    ?>
    
     
    • Thanks Thanks x 1
  5. Cnotey

    Cnotey Power Member

    Joined:
    Jun 25, 2010
    Messages:
    707
    Likes Received:
    911
    Location:
    Seattle
    Home Page:
    Strangest question ever. Why would you want to do this? I can theorize some very blackhat uses for it. Hopefully you are not going to use this with Adsense.
     
  6. Anubis1980

    Anubis1980 Regular Member

    Joined:
    Mar 20, 2010
    Messages:
    276
    Likes Received:
    81
    Occupation:
    webmaster and father
    If you got a community e.g. , you can reduce apache requests by using this:

    PHP:
    <link rel="stylesheet" href="./css/stylecss.php" title="stylesheet" type="text/css" /> 
    Make textfile and put this into:

    PHP:
    <?php
    $offset 
    60 60 24 30// Cache for a month
    header("Content-type: text/css");
    header ("Cache-Control: max-age=" $offset ", must-revalidate");
    header ("Expires: " gmdate ("D, d M Y H:i:s"time() + $offset) . " GMT");

      
    ob_start("compress");
      function 
    compress($buffer) {
        
    /* remove comments */
        
    $buffer preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!'''$buffer);
        
    /* remove tabs, spaces, newlines, etc. */
        
    $buffer str_replace(array("\r\n""\r""\n""\t"'  ''    ''    '), ''$buffer);
        
    /* remove last semicolon */
        
    $buffer str_replace(array(";}""; }"), '}'$buffer);
        return 
    $buffer;
      }

      
    /* your css files */
      
    include('styles_global.css');
      include(
    'styles.css');
      include(
    'styles_new.css');
      include(
    'styles_comments.css');
      include(
    'styles_blog.css');
      include(
    'styles_stats.css');
      include(
    'styles_ads.css');

        
    ob_end_flush();
    ?> 
    Save as stylecss.php.
    It reduce a bit your loading time.
     
  7. SurajitPays

    SurajitPays BANNED BANNED

    Joined:
    Dec 14, 2010
    Messages:
    22
    Likes Received:
    0
    Why would you want to do this?
     
  8. vernonthekiller

    vernonthekiller Newbie

    Joined:
    Oct 3, 2010
    Messages:
    37
    Likes Received:
    7
    i guess he's thinking it might get people to stay on the page longer. it makes sense to me if thats what he's after.
     
  9. likeskoolaid

    likeskoolaid Regular Member

    Joined:
    Dec 27, 2009
    Messages:
    352
    Likes Received:
    104
    Occupation:
    \˚ㄥ˚\
    Location:
    \ᇂ_ᇂ\
    edit: read wrong
     
    Last edited: Dec 14, 2010
  10. easyroms

    easyroms Newbie

    Joined:
    Nov 5, 2009
    Messages:
    15
    Likes Received:
    1
    create style.php:
    PHP:
    <?php
     sleep
    (25);
     echo 
    chr(64) . "import url(style.php?"time() .");";
    ?>
     
    on your page include the style.php file via stylesheet:
    HTML:
    <link rel="stylesheet" href="style.php" type="text/css">
    
    Note: I used chr(64) because BHW wouldnt let me post the AT symbol :(