Connecting Tech Pros Worldwide Help | Site Map

Refresh browser window on focus - is this possible?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:59 AM
jeff@dnuk.com
Guest
 
Posts: n/a
Default 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

  #2  
Old July 20th, 2005, 11:59 AM
Lasse Reichstein Nielsen
Guest
 
Posts: n/a
Default 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, 11:59 AM
e
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.