Giter Site home page Giter Site logo

walitoff / screen-orientation-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.41 MB

Tests for programmatically getting and locking screen orientation with JS

Home Page: https://screen-orientation-test.walitoff.com/

License: GNU General Public License v3.0

HTML 54.66% JavaScript 45.09% CSS 0.25%
javascript orientation-changes orientation-detection webtesting deviceorientation-api

screen-orientation-test's Introduction

Codacy Badge Codacy Security Scan Dependency Review ESLint Own Tests Deploy Hugo site to Pages GitHub

Tests for programmatically getting and locking screen orientation with JS

This project builds a web page for testing user's browser if it can report active device screen orientation and if it's possible to change and lock the screen orientation programmatically with JS. It's useful if you need to check if your iPhone or Android device supports this functionality and if you can use it in your web projects.

DEMO IS HERE

Cover image

How to test

  1. Open the demo page
  2. Rotate your device in hands, the page should detect screen orientation change and display current state
  3. Try to change the screen orientation programmatically by clicking the buttons with the desired screen orientation. Please note that not all orientation types may be supported by your device. Probably it will not work if you're not in fullscreen mode.
  4. Try clicking fullscreen mode button. Most modern browsers require fullscreen mode activated to allow rotations.
  5. Try different browsers. The results can vary a lot.
  6. Install the website as an app (PWA) and try the previous steps.

Sample videos

Example 1. Android 10 Chrome browser 111.0.5563.116

Supports orientation detection, full screen mode activation and programmatically change and lock of screen orientation.

android-chrome-111.0.5563.115_x265_002.mp4

Example 2. Android 10, PWA mode, Chrome browser 111.0.0.0

Supports orientation detection, full screen mode activation and programmatically change and lock of screen orientation.

android-pwa_x265_001.mp4

Example 3. Android 10 DuckDuckGo 5.153.0

Supports orientation detection, full screen mode activation. Programmatically change and lock of screen orientation is not supported.

DuckDuckGo-5.153.0_x265.mp4

Some test results

Browser OS Type Mode Detection Fullscreen Mode Rotation
Google Chrome 111.0.5563.116 Android 7,10,12 Mobile Browser
Google Chrome 111.0.0.0 Android 7,10,12 Mobile PWA
Google Chrome 111.0.5563.147 Windows 11 Desktop Browser
Firefox 111.1.0 Android 7 Mobile Browser
Brave 1.49.129 Android 7 Mobile Browser
DuckDuckGo 5.153.0 Android 10, 12 Mobile Browser
Yandex Browser 23.30.1 Android 12 Mobile Browser
Safari 15.6.4 iOS 15.7.3, 15.7.4 Mobile Browser
Safari 16.3 iOS 13.2.1 Ventura Desktop Browser
Safari 16.4 iOS 13.3 Ventura Desktop Browser

If you want to share your test results, please open an issue or PR.

Technical details

We use two methods to obtain screen lock:

Some devices like desktop computers usually don't support screen rotation. If device does not support rotation, you will get such message. However, such message may be seen on mobile devices too, if the browser does have a full support for the screen rotation API.

Usually the screen rotation lock requires the fullscreen mode first to be activated in browser. There's a button to enter and exit fullscreen mode in the demo using Element.requestFullscreen().
Fullscreen mode is supported by most modern browsers.

The website is built with Hugo.

screen-orientation-test's People

Contributors

dependabot[bot] avatar rvalitov avatar

Watchers

 avatar

screen-orientation-test's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.