Reputation: 31
I am opening an ASPX page in Phonegap using window.open("page.aspx"). It's opening fine. But how do I disable the zooming of that page? I've tried using but this didn't help. here is my index.html
<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser.close Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0, user-scalable=no" />
<script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
var ref = window.open('http://google.com/', '_blank', 'location=no');
}
</head>
<body>
</body>
</html>
Upvotes: 1
Views: 3356
Reputation: 8880
This worked for me:
document.ontouchmove = function(event){
event.preventDefault();
}
I guess this stops the touch events getting to the topmost element.
It also stops the 'bouncing'
Upvotes: 0
Reputation: 11
The value in your <meta> tag,
user-scalable=no
should disable zooming. Also it make sure attribute values are properly formed. For example:
maximum-scale=1.0
instead of
maximum- scale=1.0
This may possibly be causing the viewport properties for not rendering. Using the
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
scrolling should be disabled in inAppBrowser.
Upvotes: 1
Reputation: 5139
You can't do this using the inAppBrowser if the page you're showing doesn't have disabled zooming.
Upvotes: 1