rotation.html 955 B

1234567891011121314151617181920212223242526272829303132
  1. <html>
  2. <script>
  3. var gotHide = false;
  4. var gotOrientationChange = false;
  5. var attachedListeners = false;
  6. async function doRequestFullscreen() {
  7. return document.documentElement.requestFullscreen();
  8. }
  9. async function toggleFullscreen() {
  10. if (!attachedListeners) {
  11. attachedListeners = true;
  12. document.addEventListener("visibilitychange", function() {
  13. if (document.visibilityState !== 'visible') {
  14. gotHide = true;
  15. }
  16. });
  17. window.addEventListener("orientationchange", function() {
  18. gotOrientationChange = true;
  19. });
  20. }
  21. if (!document.fullscreenElement) {
  22. await doRequestFullscreen();
  23. await screen.orientation.lock("landscape");
  24. } else {
  25. document.exitFullscreen();
  26. }
  27. }
  28. </script>
  29. <body style="height:5000px" onclick="toggleFullscreen();">
  30. <p>A (mostly) empty page.</p>
  31. </body>
  32. </html>