Skip to content

Instantly share code, notes, and snippets.

@JigarM
Forked from pec1985/webViewZoom.js
Created April 9, 2013 11:53
Show Gist options
  • Save JigarM/5345099 to your computer and use it in GitHub Desktop.
Save JigarM/5345099 to your computer and use it in GitHub Desktop.
var win = Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var webView = Ti.UI.createWebView({ url:'http://www.appcelerator.com', scalesPageToFit:true,setZoomScale:2, top:0, left:0});
win.add(webView);
var firstTime = true;
var htmlHack = '';
htmlHack += 'var element = document.createElement("meta");';
htmlHack += 'element.name = "viewport";';
htmlHack += 'element.content = "maximum-scale=100";';
htmlHack += 'var head = document.getElementsByTagName("head")[0];';
htmlHack += 'head.appendChild(element);';
webView.addEventListener('load', function(e){
webView.evalJS(htmlHack);
});
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment