470,618 Members | 1,723 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,618 developers. It's quick & easy.

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
Jul 20 '05 #1
2 18702
je**@dnuk.com writes:
I'm building an internal web application using HTML/PHP/Javascript. .... I would like a browser window that has just gained the focus to
refresh. Is this possible and how?


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 - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
e
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
<je**@dnuk.com> wrote in message
news:a4********************************@4ax.com...
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

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bilal | last post: by
19 posts views Thread by Jay | last post: by
14 posts views Thread by Shiperton Henethe | last post: by
4 posts views Thread by Alejandro Narancio | last post: by
reply views Thread by Brad White | last post: by
1 post views Thread by Alex Calder | last post: by
6 posts views Thread by Chris Beall | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.