views:

732

answers:

3

I have a page on which, periodically, I must change the URL to incorporate some GET parameters in the background using JavaScript, such that the page refreshes using the new GET parameters.

So, for example, I'll periodically do

window.location.href = window.location.host + '?' + ss;

or

window.location.search = '?' + ss;

Where 'ss' is the new query string, e.g.: "foo=3&bar=1". These 'refreshes' will happen when the window is in the background.

My problem is that, on IE browsers the refresh causes the window to steal focus. Is there anyway to avoid or circumvent this?

A: 

Does the whole page have to refresh? I would think that if you IFRAMED the content it wouldnt steal focus. I've never intentionally tried this with a background window but I find it curious that IE does that. Which version is doing this as I'd like to replicate it.

Mech Software
I saw this behavior on IE 6 The window will steal focus when it calls "replace" on IE. Wild.
Kyle
Obviously 'google.com' there should by preceded by http...(my comment was sanitized by SO)
Kyle
+1  A: 

Perhaps it would be worthwhile to use a AJAX call to get the new data, instead of reloading a frame?

Emil Stenström
+1  A: 

I would definetely use Ajax. Refreshing the content this way is a better user experience, especially due to its asynchronous manner. Also, not using parameters in the URL is always a good practice if your site aims to have good SERP results.

G Berdal