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

221
Visualizações
Maximized window? Wrong results for window.screenX and window.outerHeight in Firefox

I need to detect via javascript if the window is maximized (=covers the available screen). So I need to know if the height and width of the browser are at maximum AND if the window is in the left top of the screen. I found solutions on the internet, but they don't work in Firefox:

if(screen.availHeight == window.outerHeight && screen.availWidth == window.outerWidth && window.screenX == 0 && window.screenY == 0)

This code works for Google Chrome and for Opera, but not for Firefox: In Firefox it doesn't work, because, when the window is maximized, the value of window.outerHeight is bigger than screen.availHeight (although it should be exactly the same). Furthermore window.screenX and window.screenY are -7 (although the value should be 0).

I think that Firefox gives wrong values. Is it a bug and one needs to inform the developers of Firefox? Or, if not, how can I deal with this problem?

I've already modified the code so it works for Chrome, Opera AND Firefox:

if(screen.availHeight <= window.outerHeight && screen.availWidth <= window.outerWidth && window.screenX < 10 && window.screenX > -10 && window.screenY < 10 &&window.screenY > -10)

But I'm still not satisfied, because it's not exact and, as I don't understand why Firefox is giving these strange values, I also don't know how big the acceptance-range needs to be. (Is window.screenX only in my case -7 or on all screens on all computers as long as they use Firefox?)

about 4 years ago · Juan Pablo Isaza
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