Categories
JavaScript Answers

How to force landscape orientation mode with JavaScript?

Spread the love

Sometimes, we want to force landscape orientation mode with JavaScript.

In this article, we’ll look at how to force landscape orientation mode with JavaScript.

How to force landscape orientation mode with JavaScript?

To force landscape orientation mode with JavaScript, we can use the screen.orientation.lock method.

For instance, we write

screen.orientation.lock("landscape");

to call screen.orientation.lock to lock the screen to landscape mode.

Conclusion

To force landscape orientation mode with JavaScript, we can use the screen.orientation.lock method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *