Created
August 5, 2021 23:11
-
-
Save kairusds/ead7375c9f488e26f76461cf418cd16e to your computer and use it in GitHub Desktop.
Fix fullscreen orientation on Chrome mobile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Fullscreen Landscape | |
// @namespace https://kairusds.js.org/ | |
// @version 0.1 | |
// @description Fix Chrome mobile fullscreen orientation | |
// @author kairusds | |
// @match http://*/* | |
// @match https://*/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
document.addEventListener('fullscreenchange', (event) => { | |
if(!document.fullscreenElement){ | |
screen.orientation.unlock(); | |
} | |
screen.orientation.lock("landscape-primary"); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment