How to get window.focus() to work in firefox [duplicate]

Does anyone have a clue on how to be able to use window.focus() in FireFox? (27.0.1). I have tried all the about:config settings out there but still no luck.

My code looks something like this:

var wi ='myUrl');

== EDIT ==

I'm trying to make this work in FireFox on my machine, not for any other users so please refrain from the standard "let your users decide" or "it depends on the user's settings" as I want to get this to work for a local project :)



Tools > Options, Content area, "Advanced" button to the right of "Enable JavaScript" should give you the option to allow this behavior. If you're on Linux, the navigation might be slightly different.

Note, it is generally considered best practice to allow the user to choose what window should be in focus.


This is about:config you're referring to: dom.disable_window_flip

In FF 27.0.1 I am able to open a new window with focus by providing window name and option parameters to, and then calling focus.

var wi ='', 'window_name', 'height=200,width=200');

Example here:

For Chrome support, you'll want to check out: Google Chrome "" workaround?


If you want to open a tab and give the tab focus in FF (27.0.1), and simply calling'url') is not giving you the desired result, try checking the "When I open a new tab, switch to it immediately" option. It can be found in Tools > Options > Tabs


According to Window.focus specification from Mozilla, that's not possible. It depends on the user's settings.

Makes a request to bring the window to the front. It may fail due to user settings and the window isn't guaranteed to be frontmost before this method returns.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.