One of the most important thing in this venture was to disable orientation changing of the phone. Simplest way to check if it is in landscape or in portrait mode (in every device, because I know there are functions dedicated for Iphone and maybe some for Android also) is to check if height of the screen is bigger or lower than it's width.
It's not possible to guess in which mode user enters the page (game in that case) so it's important to check it in the begging, and each time the browser's window resize.
function checkOrientation() {
if (window.innerHeight > window.innerWidth) {
//portrait mode
} else if(window.innerHeight< window.innerWidth) { //landscape mode
}
}
Try this link from your phone to test it, or just open it in desktop browser and change window size: LANDSCAPE VS PORTRAIT
checkOrientation();
window.onresize = function() { //your code
checkOrientation();
}
I know it won't works in IE, but almost all of the mobile web browsers are based on WebKit.
Mobile devices with internet access are becoming increasingly popular. This topic section on mobile devices for business includes resources and tips for selecting and maintaining all types of mobile devices such as smartphones, cell phones, netbooks and laptops for your business users. Thanks.
ReplyDeleteThis method is very good, I test once, use is also very simple, thank you for sharing.
ReplyDeleteThere is a problem with this method.. when virtual keyboard is visible in portrait mode, checkOrientation function will return landscape.
ReplyDeleteI was very pleased to find this site. I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post. cell phone detector
ReplyDeleteGood work you have done and shared with us.
ReplyDeleteThis article offers clear idea in favor of the new users of blogging, that in fact
ReplyDeleteGreat & Useful Articles
ReplyDeleteBootstrap Training | Bootstrap Course | Bootstrap Online Training | Bootstrap Training in Chennai | Bootstrap Interview Questions
I enjoyed your blog Thanks for sharing such an informative post. We are also providing the best services click on below links to visit our website.
ReplyDeleteweb design company in nagercoil
web development company in nagercoil
website design company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
best web design company in nagercoil
web design company in velachery
web development company in velachery
website design company in velachery
website development company in velachery
web designing company in velachery
website designing company in velachery
best web design company in velachery
Thanks for Sharing - ( Groarz branding solutions )