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

213
Views
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
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!