Skip to content

Instantly share code, notes, and snippets.

@dylanhthomas
Created June 18, 2013 16:46
Show Gist options
  • Save dylanhthomas/5807093 to your computer and use it in GitHub Desktop.
Save dylanhthomas/5807093 to your computer and use it in GitHub Desktop.
iPad Conditional Viewport - Serve different viewports to different clients based on user-agent. With php this is a trivial affair, as long as you know the user-agents that your targeting.
<?php
//Probably an iPad
if(stristr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
echo '<meta name="viewport" content="width=980;user-scalable=yes;" />';
}
else{
echo '<meta name="viewport" content="width=1150;user-scalable=yes;" />';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment