Connecting Tech Pros Worldwide Help | Site Map

Refresh browser window on focus - is this possible?

  #1  
Old July 20th, 2005, 12:59 PM
jeff@dnuk.com
Guest
 
Posts: n/a
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
  #2  
Old July 20th, 2005, 12:59 PM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a

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/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
  #3  
Old July 20th, 2005, 12:59 PM
e
Guest
 
Posts: n/a

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="refreshMe()">
....

I dunno if "window.location = 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.com> wrote in message
news:a4jnrvo67ibgfvtkr7dk613di4usn7m94v@4ax.com...[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]


Closed Thread