What is this?
PleaseRotate.js is a tiny javascript script that you include on your page if you would like your mobile users to view your site in a certain orientation. If they are not viewing it in the desired orientation, a message and a helpful animation will ask them politely to switch to the other orientation.
With the default settings, your mobile users will be presented with a screen like the one over there to the right.
But why? This is horrible UX!
I agree, for most sites this is a really bad idea. But there are some times when you want your users to view your site in a certain orientation because it simply isn't worth the time to make it good in other orientations. I use it for things like technical demos that look horrible in portrait mode.
How do I use this?
PleaseRotate.js is completely self-contained in a javascript file and does not require any external css files or images. Just throw it in a script tag and it will ask your mobile users in portrait mode to switch to landscape.
It can be easily configured to force users into portrait mode if you would like. It also supports overriding styles using CSS, and a whole bunch of different options. Some documentation is available on the Github repo.