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?)