This question already has an answer here:
i want to disable orientation:Landscape in our app and website using jquery. so please help me for disable in app and website.
</div>
This question already has an answer here:
i want to disable orientation:Landscape in our app and website using jquery. so please help me for disable in app and website.
</div>
i'm not sure it will work, but Try this
<head>
<style type="text/css">
#landscape{
position: absolute;
top: 0px;
left: 0px;
background: #000000;
width: 100%;
height: 100%;
display: none;
z-index: 20000;
opacity: 0.9;
margin:0 auto;
}
#landscape div{
color: #FFFFFF;
opacity: 1;
top: 50%;
position: absolute;
text-align: center;
display: inline-block;
width: 100%;
}
</style>
<script>
function doOnOrientationChange()
{
switch(window.orientation)
{
case -90:
document.getElementById("landscape").style.display="block";
break;
case 90:
document.getElementById("landscape").style.display="block";
break;
default:
document.getElementById("landscape").style.display="none";
break;
}
}
//Listen to orientation change
window.addEventListener('orientationchange', doOnOrientationChange);
</script>
</head>
<body onload="doOnOrientationChange();">
<div id="landscape"><div>"Rotate Device to Portrait"</div></div>
</body>