Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda