469,927 Members | 1,835 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Focusing in Firefox and Safari? (window.focus())

Is it possible to focus a window in firefox and safari??

i have a webpage that opens another window, it then focuses on the original window (the new window that opened now behind it in the background). In IE it works fine but in firefox and safari it doesn't focus on the original page. I have looked on all sorts of forums etc and apparently FF and Safari block script that uses window.focus(); So just wondering if there is another way to focus it. [i have tried this.window.focus(), this.focus() and self.focus()]

Any help would be appreciated. Thankyou in advance.
Oct 25 '07 #1
3 17655
16,027 Expert Mod 8TB
Try focusing from the child window by using window.opener.focus().
Nov 5 '07 #2
if you find the code snippet:

<body onload="self.focus()">

not work in Firefox 2.0 and above, this is not a bug. Firefox has an advanced Javascript option called “Raise or lower windows” which is deactivated by default. You may find this option under:

* Tools
* Options…
* Content tab
* Advanced button next to “Enable JavaScript”
* check the box named "Raise or Lower Windows"

Once enabled the above code will work again. ;-)
Nov 16 '07 #3
16,027 Expert Mod 8TB
Thanks for the tip. This is also discussed here.
Nov 16 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Wei | last post: by
2 posts views Thread by Wei | last post: by
3 posts views Thread by Gandalf | last post: by
4 posts views Thread by Spizzat2 | last post: by
3 posts views Thread by omerbutt | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.