Viewport Meta Tag:
You can use the following meta tag which will give a fluid width to the web application. So even if you change the screen orientation it will resize automatically. Works on iPhone and Android, not sure about other devices.
<meta name="viewport" content="width=device-width">
You can detect a device by sniffing the User Agent string. However it does not work 100% for an iPad because it has ‘iPhone’ string in the User Agent. List of all User Agents by device
return (navigator.platform.indexOf("iPad") != -1);
return (navigator.platform.indexOf("Android") != -1);
You can use CSS media queries to determine if the device is being held in vertical or horizontal orientation such as:
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css">
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">;
if you want to target styles for specific devices:
<link href="ipad.css" rel="stylesheet" media="only screen and (min-device-width: 768px) and (max-device-width: 1024px)" type="text/css" />
## iPhone 3GS
<link href="iphone.css" rel="stylesheet" media="only screen and (max-device-width: 480px)" type="text/css" />
## iPhone 4
<link href="retnia.css" rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width: 480px)" type="text/css" />
Mobile Device Feature Detection:
Rather than detecting the current user agent and alter the page presentation based on which browser is running, it is a good practice to perform feature detection. This means that prior to executing code which relies on a browser feature, we test to ensure that the feature works properly.
Following are a few resources that explain how feature detection works:
My company is relocating me to Houston, TX. I have never been to Houston before so any advice you can give me would be greatly appreciated!
Any suggestions on where to live and how I can go about finding a 3 bedroom house or which schools (high/middle) are good around Houston would be greatly appreciated.
A bit late to the party but I finally got me an iPhone a couple of days ago and am really enjoying it. Here are a couple of Apps I have installed so far:
I have installed the WPtouch WordPress plugin which transforms this blog into an iPhone application-like experience when viewed from an iPhone or iPod touch.
Have you ever wondered why your site does not have a high conversion rate even though you have a good amount of traffic? The quickest way to fix the problem is by surveying your users. Here is a great post by Avinash Kaushik on how you can easily implement a short website survey to ask your users and gain a wealth of insight. Easy to implement and highly effective.