views:

451

answers:

6

Is there any way of reliably detecting if a browser is running in full screen mode? I'm pretty sure there isn't any browser API I can query, but has anyone worked it out by inspecting and comparing certain height/width measurements exposed by the DOM? Even if it only works for certain browsers I'm interested in hearing about it.

A: 

If you really want to do it reliably, have you considered that max width/height in a mobile device, for example, is less than any mode a sane desktop user will probably have?

soulmerge
There is a minimum supported resolution for the web application in question and hence it's not an issue in this case :)
Simon Lieschke
A: 

The question is why do you need it?
Maybe there is another solution to your problem.

z-boss
That's outside the scope of the question I asked.
Simon Lieschke
+3  A: 

What about determining the distance between the viewport width and the resolution width and likewise for height. If it is a small amount of pixels (especially for height) it may be at fullscreen.

However, this will never be reliable.

alex
If the browser is actually running fullscreen, the difference between the viewport size and the resolution should equal 0. Unless you're running multiple monitors, i guess.
Arve Systad
Except a lot of 'full screen' implementations have a simplified chrome which *may* effect it.
alex
Are scrollbars counted as part of the viewport?
Roger Pate
I'm not sure - you'll have to experiment.
alex
This was the lines I was thinking along. I could write a test page which displays all the dimensions of interest and compare the dimensions reported for the page when displayed normally and full screen. From there I *might* be able to determine the state for certain browsers.
Simon Lieschke
Maybe something like if (resolutionHeight - viewportHeight) < 100) = fullscreen = true
alex
+3  A: 

Opera treats full screen as a different CSS media type. They call it Opera Show, and you can control it yourself easily:

@media projection {
  /* these rules only apply in full screen mode */
}

Combined with Opera@USB, I've personally found it extremely handy.

Roger Pate
+2  A: 

What I really dislike is all of these counter-questions - "what are you trying to achieve? maybe there is another way?" etc.

People, if you know the answer or can advise, please do so. Otherwise, sit tight and wait until someone else does. Please..

And thanks to Alex who came up with a way of achieving it - not a perfect way, as he himself pointed out, but a way nonetheless.

A: 

Hi By default when we works in Full Screen mode (F11) the client rectangle and the window rectangle suppose to be equal. From some reason in IE6 there is border different 2 pixel in width and 2 pixel in Height

Tsur