Thursday 5 July 2012

WebView Settings


Note: To know the HTML5 browser support for your device, you only need to open the url in your browser: http://html5test.com/


WebSettings settings = mWebView.getSettings();
//To enable the built-in zoom
settings.setBuiltInZoomControls(true);


//To enable JavaScript
settings.setJavaScriptEnabled(true);


//To enable Plugin
settings.setPluginState(PluginState.ON);


Plugin:
plug-ins are commonly used in web browsers to play video, 
scan for viruses, and display new file types. 
Well-known plug-ins examples include 
Adobe Flash Player, QuickTime, and Microsoft Silverlight.


//To enable or disable file access within WebView. 
//File access is enabled by default.
settings.setAllowFileAccess(true);


//To enable dom storage
//DOM Storage is a way to store meaningful amounts of 
//client-side data in a persistent and secure manner.
settings.setDomStorageEnabled(true);


//To enable wide viewport.
settings.setUseWideViewPort(true);


//To enable JavaScript to open windows automatically.
settings.setJavaScriptCanOpenWindowsAutomatically(true);


//To enable twitter, youtube etc.
settings.setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) 
AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");


Detailed Description: WebSettingsWebView
profile for Vineet Shukla at Stack Overflow, Q&A for professional and enthusiast programmers

1 comment: