A question about refresh

Discussion in 'Javascript' started by sheldonlg, May 13, 2011.

  1. sheldonlg

    sheldonlg Guest

    I have a page that gathers information from a database and shows a
    status. Asynchronously, some other process modifies that status at a
    shortly later time.

    I have placed a button on the page to do a refresh of the page. I use
    location.reload() as the onClick method.

    Here are the results:
    1 - Clicking the button does not show the changed status
    2 - Hitting F5 does not show the changed status
    3 - Clicking the refresh button on the menu bar does not show the
    changed status
    4 - Clicking the arrow to the right of the address field DOES show the
    changed status.

    I would like to know how I need to code my refresh button on the page so
    that it shows the changed status like #4 above. Any help will be
    appreciated.

    (I have looked quite a bit through Google, but haven't found the answer
    and changing an ini file is not really an option as this is a
    mult-purpose page -- I inherited this rather old code).

    --
    Shelly
     
    sheldonlg, May 13, 2011
    #1
    1. Advertising

  2. sheldonlg

    sheldonlg Guest

    On 5/13/2011 3:08 PM, sheldonlg wrote:
    > I have a page that gathers information from a database and shows a
    > status. Asynchronously, some other process modifies that status at a
    > shortly later time.
    >
    > I have placed a button on the page to do a refresh of the page. I use
    > location.reload() as the onClick method.
    >
    > Here are the results:
    > 1 - Clicking the button does not show the changed status
    > 2 - Hitting F5 does not show the changed status
    > 3 - Clicking the refresh button on the menu bar does not show the
    > changed status
    > 4 - Clicking the arrow to the right of the address field DOES show the
    > changed status.
    >
    > I would like to know how I need to code my refresh button on the page so
    > that it shows the changed status like #4 above. Any help will be
    > appreciated.
    >
    > (I have looked quite a bit through Google, but haven't found the answer
    > and changing an ini file is not really an option as this is a
    > mult-purpose page -- I inherited this rather old code).
    >


    ....and BTW, if it means anything it is written with php4 code and
    register_globals=on. (Can't be changed).

    --
    Shelly
     
    sheldonlg, May 13, 2011
    #2
    1. Advertising

  3. sheldonlg wrote:

    > I have a page that gathers information from a database and shows a
    > status. Asynchronously, some other process modifies that status at a
    > shortly later time.
    >
    > I have placed a button on the page to do a refresh of the page. I use
    > location.reload() as the onClick method.
    >
    > Here are the results:
    > 1 - Clicking the button does not show the changed status
    > 2 - Hitting F5 does not show the changed status
    > 3 - Clicking the refresh button on the menu bar does not show the
    > changed status
    > 4 - Clicking the arrow to the right of the address field DOES show the
    > changed status.


    If it were not for 2, 3, and 4, window.location.replace(document.URL, true)¹
    would have sufficed. However, because of those, you need to apply
    <http://www.mnot.net/cache_docs/>.

    > I would like to know how I need to code my refresh button on the page so
    > that it shows the changed status like #4 above. Any help will be
    > appreciated.


    This problem cannot be solved with client-side scripting alone.


    PointedEars
    ___________
    ¹ Always use qualified references: window.location, window.open(…),
    window.alert(…), etc.
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
     
    Thomas 'PointedEars' Lahn, May 13, 2011
    #3
  4. sheldonlg wrote:

    > ...and BTW, if it means anything it is written with php4 code and
    > register_globals=on. (Can't be changed).


    It would better be changed soon, before it is too late.

    <http://www.php.net/archive/2008.php#id2008-08-07-1>
    <http://php.net/manual/en/ini.core.php>


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
     
    Thomas 'PointedEars' Lahn, May 13, 2011
    #4
  5. Thomas 'PointedEars' Lahn wrote:

    > sheldonlg wrote:
    >> ...and BTW, if it means anything it is written with php4 code and
    >> register_globals=on. (Can't be changed).

    >
    > It would better be changed soon, before it is too late.
    >
    > <http://www.php.net/archive/2008.php#id2008-08-07-1>
    > <http://php.net/manual/en/ini.core.php>


    and

    <http://php.net/manual/en/migration53.deprecated.php>


    PointedEars
    --
    Danny Goodman's books are out of date and teach practices that are
    positively harmful for cross-browser scripting.
    -- Richard Cornford, cljs, <cife6q$253$1$> (2004)
     
    Thomas 'PointedEars' Lahn, May 13, 2011
    #5
  6. Thomas 'PointedEars' Lahn wrote:

    > sheldonlg wrote:
    >> ...and BTW, if it means anything it is written with php4 code and
    >> register_globals=on. (Can't be changed).

    >
    > It would better be changed soon, before it is too late.
    >
    > <http://www.php.net/archive/2008.php#id2008-08-07-1>
    > <http://php.net/manual/en/ini.core.php>


    and

    <http://php.net/manual/en/migration53.deprecated.php>


    F'up2 comp.lang.php

    PointedEars
    --
    Danny Goodman's books are out of date and teach practices that are
    positively harmful for cross-browser scripting.
    -- Richard Cornford, cljs, <cife6q$253$1$> (2004)
     
    Thomas 'PointedEars' Lahn, May 13, 2011
    #6
  7. sheldonlg

    sheldonlg Guest

    On 5/13/2011 3:24 PM, Thomas 'PointedEars' Lahn wrote:
    > sheldonlg wrote:
    >
    >> ...and BTW, if it means anything it is written with php4 code and
    >> register_globals=on. (Can't be changed).

    >
    > It would better be changed soon, before it is too late.


    Not my call! Besides, this is an INTRAnet application, so all users are
    known. There is no way they are going to revamp everything in this
    massive application. It still uses the feature that there are variables
    that are the same name as the fields automatically without using gets or
    posts.

    >
    > <http://www.php.net/archive/2008.php#id2008-08-07-1>
    > <http://php.net/manual/en/ini.core.php>
    >
    >
    > PointedEars



    --
    Shelly
     
    sheldonlg, May 13, 2011
    #7
  8. sheldonlg

    Jeff North Guest

    On Fri, 13 May 2011 15:10:09 -0400, in comp.lang.javascript sheldonlg
    <>
    <iqjvn8$jh0$> wrote:

    >| On 5/13/2011 3:08 PM, sheldonlg wrote:
    >| > I have a page that gathers information from a database and shows a
    >| > status. Asynchronously, some other process modifies that status at a
    >| > shortly later time.
    >| >
    >| > I have placed a button on the page to do a refresh of the page. I use
    >| > location.reload() as the onClick method.
    >| >
    >| > Here are the results:
    >| > 1 - Clicking the button does not show the changed status
    >| > 2 - Hitting F5 does not show the changed status
    >| > 3 - Clicking the refresh button on the menu bar does not show the
    >| > changed status
    >| > 4 - Clicking the arrow to the right of the address field DOES show the
    >| > changed status.
    >| >
    >| > I would like to know how I need to code my refresh button on the page so
    >| > that it shows the changed status like #4 above. Any help will be
    >| > appreciated.
    >| >
    >| > (I have looked quite a bit through Google, but haven't found the answer
    >| > and changing an ini file is not really an option as this is a
    >| > mult-purpose page -- I inherited this rather old code).
    >| >
    >|
    >| ...and BTW, if it means anything it is written with php4 code and
    >| register_globals=on. (Can't be changed).


    So are you capturing the returned response from the ajax call?
    Are you 100% sure that the information is being written to the
    database?
     
    Jeff North, May 14, 2011
    #8
  9. sheldonlg wrote:

    > Thomas 'PointedEars' Lahn wrote:
    >> sheldonlg wrote:
    >>> ...and BTW, if it means anything it is written with php4 code and
    >>> register_globals=on. (Can't be changed).

    >>
    >> It would better be changed soon, before it is too late.

    >
    > Not my call!


    What kind of developer are you anyway? No, don't answer.

    > Besides, this is an INTRAnet application,


    Irrelevant.

    > so all users are known.


    All users are … listen to yourself!

    > There is no way they are going to revamp everything in this
    > massive application.


    Then they deserve what they will get.

    > It still uses the feature that there are variables that are the same name
    > as the fields automatically without using gets or posts.


    foreach(array('x', 'y', 'z') as $var)
    {
    $$var = $_REQUEST[$var];
    }

    does the same without compromising all security, preferably in local context
    (you might want to exclude $_COOKIE, though).


    F'up2 comp.lang.php

    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
     
    Thomas 'PointedEars' Lahn, May 14, 2011
    #9
  10. sheldonlg

    Luuk Guest

    On 13-05-2011 21:08, sheldonlg wrote:
    > I have a page that gathers information from a database and shows a
    > status. Asynchronously, some other process modifies that status at a
    > shortly later time.
    >
    > I have placed a button on the page to do a refresh of the page. I use
    > location.reload() as the onClick method.
    >
    > Here are the results:
    > 1 - Clicking the button does not show the changed status
    > 2 - Hitting F5 does not show the changed status
    > 3 - Clicking the refresh button on the menu bar does not show the
    > changed status
    > 4 - Clicking the arrow to the right of the address field DOES show the
    > changed status.
    >
    > I would like to know how I need to code my refresh button on the page so
    > that it shows the changed status like #4 above. Any help will be
    > appreciated.
    >
    > (I have looked quite a bit through Google, but haven't found the answer
    > and changing an ini file is not really an option as this is a
    > mult-purpose page -- I inherited this rather old code).
    >


    It looks like your browser is caching results, something like this:
    <?php
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    ?>
    (from: http://php.net/manual/en/function.header.php) might work. Your
    browser should stop caching the results.




    --
    Luuk
     
    Luuk, May 14, 2011
    #10
  11. sheldonlg

    Luuk Guest

    On 14-05-2011 09:50, Luuk wrote:
    > On 13-05-2011 21:08, sheldonlg wrote:
    >> I have a page that gathers information from a database and shows a
    >> status. Asynchronously, some other process modifies that status at a
    >> shortly later time.
    >>
    >> I have placed a button on the page to do a refresh of the page. I use
    >> location.reload() as the onClick method.
    >>
    >> Here are the results:
    >> 1 - Clicking the button does not show the changed status
    >> 2 - Hitting F5 does not show the changed status
    >> 3 - Clicking the refresh button on the menu bar does not show the
    >> changed status
    >> 4 - Clicking the arrow to the right of the address field DOES show the
    >> changed status.
    >>
    >> I would like to know how I need to code my refresh button on the page so
    >> that it shows the changed status like #4 above. Any help will be
    >> appreciated.
    >>
    >> (I have looked quite a bit through Google, but haven't found the answer
    >> and changing an ini file is not really an option as this is a
    >> mult-purpose page -- I inherited this rather old code).
    >>

    >
    > It looks like your browser is caching results, something like this:
    > <?php
    > header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    > header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    > ?>
    > (from: http://php.net/manual/en/function.header.php) might work. Your
    > browser should stop caching the results.
    >
    >
    >
    >


    oops, someone forwarded this thread to comp.lang.php and i replied to
    that.....

    but my answer has nothng to do with Javascript.... ;)

    --
    Luuk
     
    Luuk, May 14, 2011
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer

    Question: flicker on refresh

    VB Programmer, Jul 21, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    685
    VB Programmer
    Aug 6, 2003
  2. brian lanning
    Replies:
    0
    Views:
    611
    brian lanning
    Jul 29, 2003
  3. Per Magnus L?vold
    Replies:
    1
    Views:
    5,166
    John C. Bollinger
    Oct 8, 2004
  4. Pkenty
    Replies:
    0
    Views:
    412
    Pkenty
    May 28, 2004
  5. Jawahar Rajan
    Replies:
    1
    Views:
    303
    Adrienne
    Oct 1, 2003
Loading...

Share This Page