ispiro
ispiro

Reputation: 27673

FullScreen works onclick but not onload

I'm trying the code from here to start fullscreen mode. It works if executed onclick , but not onload. (I've also discovered that setting an alert before it will disable it unless the alert is clicked immediately.) So perhaps the problem is that sometimes the browser isn’t 'ready' for fullscreen.

So what is the last event fired when a page is completely ready? Or is the solution different?

Upvotes: 3

Views: 13135

Answers (3)

jsSn0wMan
jsSn0wMan

Reputation: 3

Was trying to do this myself then I came to this site Fullscreen API Phishing Attacks

Basically, if fullscreen mode was allowed onload, we don't know if site is actual website...fake site can have the lock logo saying it's safe, etc.

Upvotes: 0

H3llrais3R
H3llrais3R

Reputation: 184

well this might help Fullscreen script

But I agree with LastCoder

Fullscreen requires user interaction to initiate. It's a security feature.

Imagine if some pop-up could force you into fullscreen mode, lock your mouse pointer, and start playing an advertisement without your permission.

Upvotes: 0

Louis Ricci
Louis Ricci

Reputation: 21086

Fullscreen requires user interaction to initiate. It's a security feature.

Imagine if some pop-up could force you into fullscreen mode, lock your mouse pointer, and start playing an advertisement without your permission.

Having a 'enable full screen' link or button who's visibility is toggled in the document 'fullscreenchange' event handler seems like a practical approach.

Upvotes: 17

Related Questions