Code example for WebSettings

Methods: getUserAgentString, setJavaScriptEnabled, setUserAgentString

0
 
	@SuppressLint("SetJavaScriptEnabled") 
	protected void loadURL(String base, String session, String auth) {
		WebView slide = (WebView) getView();
		WebSettings settings = slide.getSettings();
		settings.setJavaScriptEnabled(true);
		settings.setUserAgentString(settings.getUserAgentString() + " "
				+ "/GoOnABoat/1.0"); 
		MainActivity activity = (MainActivity) getActivity();
		slide.addJavascriptInterface(new JsObject(activity), "Android");
		String url = base;
		if (session != null && auth != null) {
			url += session + "?auth=" + auth;
		} 
		Log.i("goonaboat", url);
		slide.loadUrl(url);
	} 
 
	class JsObject { 
		MainActivity activity;