requestFullscreen() can not be called automatically is because of security reasons (at least in Chrome). Therefore it can only be called by a user action such as:
- click (button, link…)
- key (keydown, keypress…)
And if your document is contained in a frame:
allowfullscreenneeds to be present on the<iframe>element*
* W3 Spec:
“…To prevent embedded content from going fullscreen only embedded content specifically allowed via theallowfullscreenattribute of the HTMLiframeelement will be able to go fullscreen. This prevents untrusted content from going fullscreen…”
Read more: W3 Spec on Fullscreen
Also mentioned by @abergmeier, on Firefox your fullscreen request must be executed within 1 second after the user-generated event was fired.