/    Sign up×
Community /Pin to ProfileBookmark

Detect fullscreen/kiosk mode in IE

Is there any way to detect if the browser window is in full-screen mode via javascript? I’ve been googling this and not getting much luck. Found one function that doesn’t work, the rest are just posts where a person asks this question and then others tell them how to do something without needing to detect if browser’s in fullscreen mode.

I have a requirement to do this. If a user w/ a certain role is not in fullscreen mode, I need to kick them out of the application (used internally, and no, I cannot change this business rule)

Any help would be appreciated. Thanks.

The code that didn’t work (always returns false):

[code]
function is_fullscreen()
{
return window.outerWidth == screen.width && window.outerHeight == screen.height;
}
[/code]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@p_phreshAug 31.2011 — looks like you're always getting false because you're using the code in IE. (window.outerHeight doesn't work in IE)

Works in FF.

You can try modifying the code a bit to so it will work with IE.

here's a couple functions I use to get screen size:

[CODE]
function pageWidth() {return window.innerWidth != null? window.innerWidth: document.body != null? document.documentElement.clientWidth:null;}
function pageHeight() {return window.innerHeight != null? window.innerHeight: document.body != null? document.documentElement.clientHeight:null;}
[/CODE]


works in both FF and IE.

Problem with IE is it doesn't take the scroll bar into account so the sizes will be off. You can account for this, and get it to work. If you're implementing on a LAN and you have control of the viewing environment you won't have to worry about modifying the code to be cross browser compliant. That's similar the world I work in.
Copy linkTweet thisAlerts:
@rnd_meAug 31.2011 — i would think 90% width or (width - 64) is close enough to assume full-screen.
Copy linkTweet thisAlerts:
@CreatureauthorSep 01.2011 — Thanks, guys! I'll try that out.
×

Success!

Help @Creature spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...