sindresorhus / screenfull

Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
https://sindresorhus.com/screenfull
MIT License
7.08k stars 698 forks source link

Set fullscreen on ready broken #43

Closed CodersBrothers closed 10 years ago

CodersBrothers commented 10 years ago

Im a little confused. Why i can't call directly 'screenfull.request()'??

For example: If you go to example page of plugin in http://sindresorhus.com/screenfull.js/ and put in console

screenfull.request($('#container')[0]);

Nothing happens....

But if you create a trigger, for examplo for all body like:

$('body').click(function () {
    screenfull.request($('#container')[0]);
});

thats works. Seems work only with a events.... Why? I need work without events, like: onready -> open fullscreen.

Whats Happens?

sindresorhus commented 10 years ago

https://github.com/sindresorhus/screenfull.js#request

Keep in mind that the browser will only enter fullscreen when initiated by user events like click, touch, key.

This is a security measure in the browser itself. Nothing can be done about it.

CodersBrothers commented 10 years ago

Sorry, i missed, thanks