Skip to content

Instantly share code, notes, and snippets.

@miketaylr
Created September 25, 2013 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miketaylr/6694112 to your computer and use it in GitHub Desktop.
Save miketaylr/6694112 to your computer and use it in GitHub Desktop.
var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf('iphone')!=-1);
(function(){
if (blackberry && navigator.userAgent.match('4.6.1'))
solve_blackberry_mess2();
if (document.location.host.indexOf('olivier') == -1) {
if (is_iphone || android) {
var supportsOrientationChange = "onorientationchange" in window,
orientationEvent = supportsOrientationChange ? "orientationchange" : "resize";
window.addEventListener(orientationEvent, function() {
if (window.orientation != 0)
badOrientation();
else
goodOrientation();
}, false);
}
if ((is_iphone || android) && window.orientation != 0)
badOrientation();
}
@miketaylr
Copy link
Author

At the bottom of the html file android is set to true:

<div id="rotationalert" style="display:none">
    <p>This website does not support landscape view.</p>
    <br />
    <p><b>Please turn your phone vertically to continue...</b></p>
</div>


<script type="text/javascript">
var isBottomPage = true, iphone=true, blackberry = false, android= true;    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment