Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.focus() not working in Firefox / Netscape?

Status
Not open for further replies.

karnaf

Programmer
Nov 16, 2002
41
IL
yes! this is another of those questions about "Is this not working in Firefox???". I can't help it :)

I have a line in my code that goes:
Code:
<script type="text/javascript">setTimeout('top.focus()', 10000);</script>

It works great in Internet Explorer 6, but does nothing in FireFox 1.0.7 or Netscape 7.2 :-(

Is it me?
I tried top.focus(), window.focus(), focus(), but nope. nada.

Mind you, I can't bypass this by putting alerts / promts / popups that will force the focus.

Many thanks, as always.
 
karnaf,

Your code suggests that you are using a frameset, or iframes. Perhaps you could give us a bit more information about your page(s) and structure - otherwise anything we do here will be purely guesswork.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
That's the sad part :-( I've narrowed it down when trying to figure out what's wrong to the simplest thing possible
Code:
<html>
<head>
<title>test</title>
</head>
<body>
<script type="text/javascript">setTimeout('window.focus()', 10000);</script>
bla
</body>
</html>

That's the whole page and it still doesn't work :-(
I've tried this on 3 different computers so far and in all I get the same (no) response. Very weird.
This is getting frustrating!

Thanks for your help!!!!!
 

Oh, and the JavaScript console of FireFox displays no error or warning msg.

10x
 
still worked for me. check your security settings, check to make sure javascript is enabled, and make sure you really are waiting 10 seconds.



*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Do you have any firewall / security software installed, such as Symantec or Norton products? I seem to remember them interfering with JavaScript execution. It would also explain why it works for cLFlaVA with no problem.

As mentioned, though... do check you have JavaScript enabled.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top