0

I am using PhoneGap 3.0 (CLI) to build a PhoneGap application.

I am also using jQuery Mobile with it. I am facing issue with allowing a particular page "user-scalable"

Meta viewport is

<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0, user-scalable=yes">

It works well when viewing it on mobile browser, but in the PhoneGap application it does not allow scaling.

Any help?

srikavineehari
  • 2,502
  • 1
  • 11
  • 21
Shoogle
  • 206
  • 1
  • 13
  • 1
    Possible duplicate with: http://stackoverflow.com/questions/15579078/phonegap-scaling-down-a-webpage-with-viewport – Samuli Hakoniemi Sep 23 '13 at 09:44
  • That one is for Phonegap (iOS). I could not find a solution that is independent of the OS. I managed to use Hammer js and manage the catch pinch in/out and scale the web page – Shoogle Sep 26 '13 at 09:53

1 Answers1

1


Obviously, Phonegap( Android) open index.html in WebView, if you want to scaling then you must enable SupportZoom. In MainActivity, add codes:

public void onCreate(Bundle savedInstanceState) {
    CookieManager.setAcceptFileSchemeCookies(true);
    super.onCreate(savedInstanceState);
    super.setIntegerProperty("loadUrlTimeoutValue", 60000);
    super.loadUrl("file:///android_asset/www/index.html");
    //Enable zoom in WebView
    WebSettings settings = super.appView.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
}

And in UIWebView (iOS), you can seeing here and here

Community
  • 1
  • 1
Hanh Le
  • 894
  • 6
  • 14
  • I could not find a solution that is independent of the OS. I managed to use Hammer js and manage the catch pinch in/out and scale the web page. – Shoogle Sep 26 '13 at 09:53
  • 1
    Oh. Did you use Hammer.js correctly? You must test in browser if it working good and in iOS device it not working then UIWebView not enable zoom. You can seeing [link](http://stackoverflow.com/questions/2219685/how-can-i-enable-zoom-in-on-uiwebview-which-inside-the-uiscrollview) – Hanh Le Sep 27 '13 at 01:37
  • I have yet to test it on iOS. I am not sure whether I will test it. The project we are working on is to develop iOS Native APP and Phonegap for Android, Windows & Blackberry. I am might test on iOS in month if I see a free time and post a feedback here. – Shoogle Sep 27 '13 at 05:22
  • I only working pinch zoom in Android and iOS, and i must config( rewrite several code, plugin and native feature) for each platform. So that, I think you must config for each platform. Noway pinch zoom independent with js. – Hanh Le Sep 27 '13 at 05:45