最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - FullScreen works onclick but not onload - Stack Overflow

programmeradmin5浏览0评论

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 pletely ready? Or is the solution different?

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 pletely ready? Or is the solution different?

Share Improve this question asked Jan 9, 2013 at 18:53 ispiroispiro 27.7k40 gold badges160 silver badges318 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 17

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.

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.

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.

发布评论

评论列表(0)

  1. 暂无评论