Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
Allow Firefox AddOn to focus window

I'm trying to write a Firefox AddOn that allows the user to quickly bring a specific open window to the front. While doing research on how to focus windows, I learned that browsers heavily restrict this to avoid misuse. Which I totally support if it is not intended by the user. In my case the user would install the AddOn to explicitly have this functionality, so focusing windows would be intended by the user.

The classic way to do this is Window.focus() but even the Mozilla docs say, that the success of this operation depends on the configuration of the user's browser.

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. - Source

In my browser (Firefox 94 on Ubuntu) it doesn't work.

I also read that setting dom.disable_window_flip to true in about:config will enable Window.focus() but it didn't - and it wouldn't be a feasible approach for an AddOn.

Firefox AddOns use a permission system and my expectation would be that there must be a permission that allows focusing windows for this specific AddOn. Unfortunately the permissions aren't very well documented and I couldn't find the right one via trial and error.

Most of the scarce information on focusing windows through AddOns that I found on the web was posted 5 to 10 years ago and doesn't work anymore.

I tried several approaches like calling browser.windows.update(tabId, { focused: true }) from the popup script (which I have a different issue with). I also tried to inject a content script that calls Window.focus() when asked to by a message from the popup script. None of those worked.

So my first question would be: is there any way today (2021, Firefox 94) to allow AddOns to bring a window to front?

And if so: can anyone please show me how?

Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you need to name your window and then focus it.

const newWindow = window.open('http://....', 'NameOfTheWindow');
newWindow.focus();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!