At the time of writing, orientation locking is experimental and doesn't work in most cases. Recent versions of Chrome on Android succeed, and Firefox on Android may work in fullscreen mode. This code attempts to cover the various implementations and wrap them into one function, returning a Promise that is resolved on success and rejected on failure.
See: