Refresh browser window on focus - is this possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jeff@dnuk.com

    #1

    Refresh browser window on focus - is this possible?

    Hello,

    I'm building an internal web application using HTML/PHP/Javascript.
    The system is flexible to the point where the user can have as many
    browser windows open for each part of the system.

    I would like a browser window that has just gained the focus to
    refresh. Is this possible and how?

    Thanks,
    Jeff
  • Lasse Reichstein Nielsen

    #2
    Re: Refresh browser window on focus - is this possible?

    jeff@dnuk.com writes:
    [color=blue]
    > I'm building an internal web application using HTML/PHP/Javascript.[/color]
    ....[color=blue]
    > I would like a browser window that has just gained the focus to
    > refresh. Is this possible and how?[/color]

    It depends on the browser. If it is an internal application, you might
    know which browser is being used.

    In Mozilla FB 0.7, IE6 and Opera 7 (probably other versions too), you
    can use:
    window.onfocus = function() { /* do someting */ };

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • e

      #3
      Re: Refresh browser window on focus - is this possible?

      I'm totally making this up, but what about:

      <script>
      function refreshMe()
      {
      window.location = window.location ;
      }
      </script>
      ....
      <BODY onFocus="refres hMe()">
      ....

      I dunno if "window.locatio n = window.location " will really force a new
      server request of the page. refreshMe() might need to be written using this
      trick:

      var now;
      now = new Date();
      window.location = window.location + '?' + now.getTime();

      This technique of appending the current time as a parameter to a resource
      name works with images; it prevents the browser from using a cached copy of
      the image (webcams use this trick to force the browser to grab the same
      image file from the server over and over without using the cached version),
      but I have NO idea if it works with window.location :p


      <jeff@dnuk.co m> wrote in message
      news:a4jnrvo67i bgfvtkr7dk613di 4usn7m94v@4ax.c om...[color=blue]
      > Hello,
      >
      > I'm building an internal web application using HTML/PHP/Javascript.
      > The system is flexible to the point where the user can have as many
      > browser windows open for each part of the system.
      >
      > I would like a browser window that has just gained the focus to
      > refresh. Is this possible and how?
      >
      > Thanks,
      > Jeff[/color]


      Comment

      Working...