Skip to content

Instantly share code, notes, and snippets.

@DanAntFerrari
Created June 14, 2013 11:50
Show Gist options
  • Save DanAntFerrari/5781242 to your computer and use it in GitHub Desktop.
Save DanAntFerrari/5781242 to your computer and use it in GitHub Desktop.
Create meta vieport an mobile tag by JS
var HandheldFriendlyTag=document.createElement('meta');
HandheldFriendlyTag.id="HandheldFriendly";
HandheldFriendlyTag.name = "HandheldFriendly";
HandheldFriendlyTag.content = "true";
document.getElementsByTagName('head')[0].appendChild(HandheldFriendlyTag);
var MobileOptimizedTag=document.createElement('meta');
MobileOptimizedTag.id="MobileOptimized";
MobileOptimizedTag.name = "MobileOptimized";
MobileOptimizedTag.content = "320";
document.getElementsByTagName('head')[0].appendChild(MobileOptimizedTag);
var viewPortTag=document.createElement('meta');
viewPortTag.id="viewport";
viewPortTag.name = "viewport";
viewPortTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0";
document.getElementsByTagName('head')[0].appendChild(viewPortTag);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment