0

I need to make a page go fullscreen on loading. I tried below:

<html>
<head>
<script type="text/javascript">
webkitEnterFullscreen();

</script>

</head>
<body onload="mozRequestFullScreen();">
<p> Hello </p>
</body>
</html>

But it does not seem to work. I have seen examples where user button is provided to go fullscreen, but none where whole page needs to e displayed in fullscreen mode.

I'm using firefox to test.

nagla
  • 87
  • 1
  • 9
  • Hi. Welcome to SO. You are calling a function, but it is not defined anywhere in your script tags. Are you missing a script reference? – Karl Gjertsen Apr 01 '16 at 07:08
  • 2
    Have a look at : http://stackoverflow.com/questions/1125084/how-to-make-in-javascript-full-screen-windows-stretching-all-over-the-screen – Apb Apr 01 '16 at 07:13
  • The simplest way is to add a [splash-screen](https://en.wikipedia.org/wiki/Splash_screen) with some button the user needs to click on to go to the app => You've got your user-interaction. – Kaiido Apr 01 '16 at 08:34
  • https://support.mozilla.org/ru/questions/1029031 – kay27 Apr 01 '16 at 09:37
  • This is not duplicate of "How to make the window full screen". – Qi Fan Aug 23 '17 at 19:06

1 Answers1

1

I need to make a page go fullscreen on loading.

You can’t.

The full screen APIs function only in the context of a user-initiated action, such as the event handler for a click.