Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

95
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda