SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: refresh code

  1. #1
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    refresh code

    this code i have that refreshes the page dosnt seem to make a flicker in firefox but it does in ie is there a fix for this

    window.onload = doLoad;

    function doLoad()
    {
    setTimeout( "refresh()", 5*1000 );
    }

    function refresh()
    {
    window.location.reload( false );
    }
    Animated Chatrooms - www.121chatrooms.net

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    It seems to work in a test page here.

    Code HTML4Strict:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    	<title>Test page</title>
    </head>
    <body>
    <script>
    window.onload = doLoad;
     
    function doLoad()
    {
        setTimeout( "refresh()", 5*1000 );
    }
     
    function refresh()
    {
        window.location.reload( false );
    }
    </script>
    </body>
    </html>

    Another more effective way is to use the meta refresh in the head section.
    <meta http-equiv="refresh" content="5" />

    Or if it's to another location
    <meta http-equiv="refresh" content="5;url=http://www.google.com" />
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it still makes the page flicker look at http://220.245.192.227 and login as guest login with ie and u will see what i mean by page flicker in ie then try in firefox and you will notice no flickering
    Animated Chatrooms - www.121chatrooms.net

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Ahh, I misunderstood what you were meaning. From the "not a flicker" comment I thought that you were meaning that Firefox didn't refresh.

    The flicker problem is because IE is a bad bad browser, there's nothing to be done about it, IE has some ugly sides to it.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there something else i can use because i need a simular code to work in ie and firefox
    Animated Chatrooms - www.121chatrooms.net

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    You could use AJAX, if the application you intend to use it for is appropriate.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its part of a text based chatroom using messages from a flatfiledb, how can i use ajax with it
    Animated Chatrooms - www.121chatrooms.net

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    I suspect that it would take greater minds than my own to properly advise here.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm anyone else?
    Animated Chatrooms - www.121chatrooms.net

  10. #10
    SitePoint Guru
    Join Date
    Sep 2007
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone?
    Animated Chatrooms - www.121chatrooms.net

  11. #11
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    How are you sending/retrieving the data to/from the flatfile DB?

    Paul is right that an AJAX approach may be better - the AJAX part would call the external file that does the DB processing, and then use the returned data to update the screen display. However I expect that it would mean a significant change to how the page is created.
    Ian Anderson
    www.siteguru.co.uk


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
  •