2

I am writing a web app for a specific android device. This "website" schould be displayed in fullscreen mode.

I found the code above here in stack overflow and it works fine with an click event, although the page should automaticaly open and stay in fullscreen when I am entering the site.

I understand the code, but the load event does not work. Is there any way, javascript, jquery to archieve this goal?

<script>
var el = document.documentElement,
rfs = el.requestFullscreen
      || el.webkitRequestFullScreen
      || el.mozRequestFullScreen
      || el.msRequestFullscreen
      ;
     rfs.call(el);
</script>
1
  • use the document ready event?
    – mtizziani
    Jan 21, 2017 at 22:14

2 Answers 2

1

The javascript fullscreen API can only be invoked by a user interaction, like a mouse/pointer click.

The reason being protecting the end-user from invasive websites. like for example, entering fullscreen or locking the pointer(on a pc) when opening the site.

2
  • that makes sense. Thanks.
    – Jake
    Jan 21, 2017 at 22:27
  • @MarLon, if this answers your question (which I think it does), you can "accept" it and close the question by clicking the arrow next to the answer. Have a look at this link for more details about why it's a good idea to accept answers.
    – ghoti
    Aug 28, 2017 at 12:22
0

Launching a website in fullscreen can be archieved via Google's web app feature and Chrome mobile.

Add this to your :

<link rel="manifest" href="manifest.json">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="ico_lg.png">

And finally the manifest.json explanation by Mozilla https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json

Here are some other tipps from Google regarding full screen mode: https://developers.google.com/web/fundamentals/native-hardware/fullscreen/

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.