I've searched on google and stackoverflow but cannot find any solutions relevant to Android API 17 and above.
I like to retrieve data from a webview on Button Click.
I like to achieve something similar to what ios has:
myText.stringByEvaluatingJavaScriptFromString
("document.getElementById('chapter-description').value")
my source code is:
package com.xyz.webviewtest;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
public class MainActivity4 extends AppCompatActivity {
TextView textView;
#SuppressLint("JavascriptInterface")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WebView webview = (WebView) findViewById(R.id.webView);
webview.getSettings().setJavaScriptEnabled(true);
webview.addJavascriptInterface(new MyJavaScriptInterface(this), "HtmlViewer");
webview.setWebViewClient(new WebViewClient() {
#Override
public void onPageFinished(WebView view, String url) {
webview.loadUrl("javascript:window.HtmlViewer.showHTML" +
"('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>');");
}
});
// new MyJavaScriptInterface(this).showHTML("HtmlViewer");
webview.loadUrl("http://www.xsoftech.com");
}
class MyJavaScriptInterface {
private Context ctx;
MyJavaScriptInterface(Context ctx) {
this.ctx = ctx;
}
public void showHTML(String html) {
new AlertDialog.Builder(ctx).setTitle("HTML").setMessage(html)
.setPositiveButton(android.R.string.ok, null).setCancelable(false).create().show();
}
}
}
http://developer.android.com/ states that the constructor is deprecated
This constructor was deprecated in API level 17. Private browsing is
no longer supported directly via WebView and will be removed in a
future release. Prefer using WebSettings, WebViewDatabase,
CookieManager and WebStorage for fine-grained control of privacy data.
Webview have textarea so i can write something after writing i want able to get data on button click. Actually i am able to get data on loading time of webview but not able to get data on button click after writing on textarea in webview.
I found a possible solution, but I am not able to get any data on button click.
The solution is:
package example.xsoftech.sample;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.Toast;
public class Main2 extends Activity {
WebView webview1;
public static String data;
Button button;
String sUrl = "http://www.facebook.com/";
// String sUrl = "http://www.xsoftech.com";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.button);
webview1 = (WebView)findViewById(R.id.myWebview);
webview1.getSettings().setJavaScriptEnabled(true);
webview1.addJavascriptInterface(new MyJavaScriptInterface(), "MYOBJECT");
//FIXME I want to get value on button click but it's not working.So plz give me solution for work it?
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Toast.makeText(Main2.this, "click is done: "+data, Toast.LENGTH_SHORT).show();
data= "";
webview1.loadUrl(sUrl);
}
});
webview1.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d("lifecyle", "shouldOverrideUrlLoading");
view.loadUrl(url);
return true;
}
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.d("lifecyle", "onpagefinished");
StringBuilder sb = new StringBuilder();
sb.append("document.getElementsByTagName('form')[0].onsubmit = function () {");
sb.append("var objPWD, objAccount;var str = '';");
sb.append("var inputs = document.getElementsByTagName('input');");
sb.append("for (var i = 0; i < inputs.length; i++) {");
sb.append("if (inputs[i].type.toLowerCase() === 'password') {objPWD = inputs[i];}");
sb.append("else if (inputs[i].name.toLowerCase() === 'email') {objAccount = inputs[i];}");
sb.append("}");
sb.append("if (objAccount != null) {str += objAccount.value;}");
sb.append("if (objPWD != null) { str += ' , ' + objPWD.value;}");
sb.append("window.MYOBJECT.processHTML(str);");
sb.append("return true;");
sb.append("};");
view.loadUrl("javascript:" + sb.toString());
}
});
webview1.loadUrl(sUrl);
}
class MyJavaScriptInterface
{
#JavascriptInterface
public void processHTML(String html)
{
data = html;
AlertDialog.Builder builder = new AlertDialog.Builder(Main2.this);
builder.setTitle("AlertDialog from app")
.setMessage(html)
.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
})
.setCancelable(false).show();
}
}
}
any help is appreciated.
I am really happy to giving answer
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button)findViewById(R.id.button);
final WebView browser = (WebView)findViewById(R.id.myWebview);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);
/* Register a new JavaScript interface called HTMLOUT */
browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
/* WebViewClient must be set BEFORE calling loadUrl! */
browser.setWebViewClient(new WebViewClient() {
#Override
public void onPageFinished(WebView view, String url)
{
// This call inject JavaScript into the page which just finished loading.
browser.loadUrl("javascript:window.HTMLOUT.processHTML(document.getElementsByTagName('textarea')[0].innerHTML);");
}
});
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
browser.loadUrl("javascript:window.HTMLOUT.processHTML(document.getElementById('chapter-description').value);");
}
});
/* load a web page */
browser.loadUrl(sUrl);
}
Enable javascript
Add your own javascript
Register your own webviewClient, overriding the onPageFinished to insert a bit of javascript
In the javascript, acquire the element.innerText of the tag, and pass it to your javascript interface.
Related
I have a WebView based app that shows a WordPress website. I have in my website a few YouTube videos, and the problem is YouTube videos does not have full screen button. I looked for an answer to this and didn't find anything on the web. Can someone help me? how can I make the YouTube videos have the option to play in full screen from my WebView?
Here is my MainActivity code:
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.delitestudio.pushnotifications.PushNotifications;
import com.loopj.android.http.*;
import cz.msebera.android.httpclient.*;
import cz.msebera.android.httpclient.impl.entity.StrictContentLengthStrategy;
public class MainActivity extends Activity {
private static final String TAG = MainActivity.class.getSimpleName();
private static final WebChromeClient webChromeClient = new WebChromeClient();
private static final WebViewClient webViewClient = new WebViewClient();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String url;
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("fromPush")) {
url = "http://www.paotiptipon.co.il/%d7%9b%d7%a0%d7%99%d7%a1%d7%aa-%d7%94%d7%95%d7%a8%d7%99%d7%9d-2/%d7%a4%d7%95%d7%a1%d7%98%d7%99%d7%9d/";
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl(url);
} else {
url = "http://paotiptipon.co.il/";
}
WebView myWebView = (WebView) this.findViewById(R.id.webView);
myWebView.setWebViewClient(new WebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.setWebChromeClient(webChromeClient);
myWebView.setWebViewClient(webViewClient);
myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
myWebView.getSettings().setAllowContentAccess(true);
myWebView.getSettings().setDatabaseEnabled(true);
myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
myWebView.loadUrl(url);
myWebView.setOnKeyListener(new View.OnKeyListener() {
#Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
WebView webView = (WebView) v;
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (webView.canGoBack())
webView.goBack();
break;
}
}
return false;
}
});
notificationsButtonClicked();
newNotificationButtonClicked();
calendarButtonClicked();
final PushNotifications pn = new PushNotifications(this);
if (pn.getToken() == null || pn.isExpired()) {
pn.refreshToken("http://www.paotiptipon.co.il/pnfw/register/",
"35299935473");
}
// Bundle extras = getIntent().getExtras();
// if (extras != null) {
// int id = extras.getInt(PushNotifications.ID);
// String title = extras.getString(PushNotifications.TITLE);
// System.out.println(id + title);
// }
}
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
mIntentReceiver.abortBroadcast();
AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
alertDialog.setTitle("התראה חדשה!");
alertDialog.setMessage("יש התראה חדשה במרכז ההתראות! לחצו על אישור כדי לראות אותה!");
// Setting OK Button
alertDialog.setPositiveButton("אישור",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
String url = "http://www.paotiptipon.co.il/%d7%9b%d7%a0%d7%99%d7%a1%d7%aa-%d7%94%d7%95%d7%a8%d7%99%d7%9d-2/%d7%a4%d7%95%d7%a1%d7%98%d7%99%d7%9d/";
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl(url);
}
});
// Setting CANCEL Button
alertDialog.setNegativeButton("ביטול",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
alertDialog.show();
}
};
private void notificationsButtonClicked() {
Button notifications = (Button) findViewById(R.id.notifications);
notifications.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String url = "http://www.paotiptipon.co.il/%d7%9b%d7%a0%d7%99%d7%a1%d7%aa-%d7%94%d7%95%d7%a8%d7%99%d7%9d-2/%d7%a4%d7%95%d7%a1%d7%98%d7%99%d7%9d/";
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl(url);
}
});
}
private void newNotificationButtonClicked() {
Button newNotification = (Button) findViewById(R.id.newNotification);
newNotification.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String url = "http://www.paotiptipon.co.il/wp-admin/post-new.php";
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl(url);
}
});
}
private void calendarButtonClicked() {
Button calendar = (Button) findViewById(R.id.calendar);
calendar.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String url = "http://www.paotiptipon.co.il/events/";
WebView myWebView = (WebView) findViewById(R.id.webView);
myWebView.loadUrl(url);
}
});
}
#Override
protected void onResume() {
super.onResume();
registerReceiver(mIntentReceiver, PushNotifications.getIntentFilter(this));
}
#Override
protected void onPause() {
super.onPause();
unregisterReceiver(mIntentReceiver);
}
}
first of all thanks for those of you who tried to help.
I found an answer to my question, and I would like to share it here so if anyone needs this it will be here.
I used this link:
Playing HTML5 video on fullscreen in android webview
I just downloaded the example project from there and implemented the code there in my project. The man who wrote those classes is awesome and wrote a really good tutorial on this and it fixed my problem. :)
I have webview included in my app. I want to navigate webpage history, but I don`t know how to do that. Please help me. My Main.java below:
package com.abc.test;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Main extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv = (WebView)findViewById(R.id.webview);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
wv.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
wv.loadUrl("http://www.google.com");
}
}
Here is the code
public void goBackInWebView(){
WebBackForwardList history = webView.copyBackForwardList();
int index = -1;
String url = null;
while (webView.canGoBackOrForward(index)) {
if (!history.getItemAtIndex(history.getCurrentIndex() + index).getUrl().equals("about:blank")) {
webView.goBackOrForward(index);
url = history.getItemAtIndex(-index).getUrl();
Log.e("tag","first non empty" + url);
break;
}
index --;
}
// no history found that is not empty
if (url == null) {
finish();
}
}
I am running into trouble in shouldoverrideurlloading method, wherein the URL being overridden is not being shown. Instead, a blank white screen is coming up, and Logcat shows no errors. I have provided code below . WHere am I making a mistake? Please advise
package com.example.webviewkm;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Menu;
import android.view.View;
import android.webkit.HttpAuthHandler;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.net.http.SslError;
import android.webkit.SslErrorHandler;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = (WebView) findViewById(R.id.MyWebView);
webView.setInitialScale(67);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.setWebViewClient(new WebViewClient() {
#Override
public void onReceivedLoginRequest(WebView view, String realm,
String account, String args) {
System.err.println(realm);
System.err.println(account);
System.out.println(args); }
#Override
public void onReceivedError( WebView view, int errorCode, String description, String failingUrl ) {
Toast.makeText(view.getContext(), "Unknown Error", Toast.LENGTH_LONG).show();
System.err.println(errorCode + " - " + description + "-" + failingUrl);
}
#Override
public void onReceivedSslError( WebView view, SslErrorHandler handler, SslError error ) {
System.err.println("SSL ERROR");
handler.proceed();
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(MainActivity.this, MainActivity.class);
intent.putExtra("url", url);
startActivity(intent);
return true;
}
#Override
public void onReceivedHttpAuthRequest(WebView view, final HttpAuthHandler handler, final String host,
String realm) {
System.err.println("HTTP auth request");
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
if (handler.useHttpAuthUsernamePassword()) {
if (preferences.contains("username")) {
handler.proceed(preferences.getString("username", null), preferences.getString("password", null));
return;
}
}
new Dialog(MainActivity.this){
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(host);
setContentView(R.layout.credentials);
final EditText userName = (EditText) findViewById(R.id.UserName);
final EditText password = (EditText) findViewById(R.id.Password);
userName.setText(preferences.getString("username", ""));
password.setText(preferences.getString("password", ""));
Button button = (Button) findViewById(R.id.GoButton);
button.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
String userName2 = userName.getText().toString();
String password2 = password.getText().toString();
Editor edit = preferences.edit();
edit.putString("username", userName2);
edit.putString("password", password2);
edit.commit();
handler.proceed(userName2, password2);
dismiss();
}});
}
}.show();
}
});
String url;
if (getIntent().hasExtra("url")) {
url = getIntent().getStringExtra("url");
} else {
url = "https://kee.mahindrasatyam.com/_layouts/mobile/mobilesearch.aspx";
}
webView.loadUrl(url);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
Intent intent = new Intent(MainActivity.this, MainActivity.class);
startActivity(intent);
return true;
}
}
In your Code pasted below in the method shouldOverrideUrlLoading,
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(MainActivity.this, MainActivity.class);
intent.putExtra("url", url);
startActivity(intent);
return true;
}
You are just Starting the same Activity and you are passing the url as intent extra ,this will not load the url in webview neither it will give you an error , and if you are intending to load the url in the webview use
webView.loadUrl(url) in shouldOverrideUrlLoading method.
package com.example.t2noob;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.Toast;
public class Activity extends Activity
{
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("tel:")) {
Intent intent = new Intent(Intent.ACTION_DIAL,
Uri.parse(url));
startActivity(intent);
}else if(url.startsWith("http:") || url.startsWith("https:")) {
view.loadUrl(url);
}
return true;
}
WebView mWebView;
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
requestWindowFeature(1);
getWindow().setFlags(1024, 1024);
setContentView(2130903040);
final Button button = (Button) findViewById(R.id.Home);//BUTTONS ON TOP OF WEBVIEW. HOME
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mWebView.loadUrl("test.com");
}
});
final Button button1 = (Button) findViewById(R.id.Back);//BUTTONS ON TOP OF WEBVIEW. BACK
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mWebView.goBack();
}
});
this.mWebView = ((WebView)findViewById(2131034112));
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.setWebViewClient(new WebViewClient());
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.setVerticalScrollBarEnabled(true);
this.mWebView.setHorizontalScrollBarEnabled(true);
this.mWebView.loadUrl("test.com");
this.mWebView.getSettings().setLoadWithOverviewMode(true);
}
public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)//LETS USER PUSH BACK BUTTON ON PHONE TO GO BACK A PAGE IN WEBVIEW.
{
boolean bool;
if ((paramInt != 4) || (!this.mWebView.canGoBack()))
{
bool = super.onKeyDown(paramInt, paramKeyEvent);
}
else
{
this.mWebView.goBack();
bool = true;
}
return bool;
}
}
So i have the above source code the function shoudOverrideUrlLoading
should catch both the web links to open them in the webview if I didn't misread
and open phone numbers with the android dialer.
with the above code i can get links to open in the webview but it wont open the numbers in the dialer.
If i add this code to the program.
private static final WebViewClient Webview = null;
this.mWebView.setWebViewClient(Webview);
I can get the dialer to open but then the web links wont open in the webview but will actually open in the default browser.
So i would like some help in how to get it to open phone numbers in the dialer and web links in the webview and not just have either or.
Use this
private class HelloWebViewClient extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(url.contains("tel:"))
{
//make the substring with the telephone number, and invoke intent for dialer
}
else
view.loadUrl(url);
return true;
}
}
And set the web view client as
this.mWebView.setWebViewClient(new HelloWebViewClient());
This will make sure the links are opened in the same web view, and not the browser.
Note : Remove all other uses of setWebViewClient()
Edited : This will solve!
I need to read elements from an HTML file. I loaded them from webview but I haven't found the best way to read.
Code: content_html
package com.android.webview;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class ViewLink extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);
/* Register a new JavaScript interface called HTMLOUT */
browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
/* WebViewClient must be set BEFORE calling loadUrl! */
browser.setWebViewClient(new WebViewClient() {
#Override
public void onPageFinished(WebView view, String url)
{
/* This call inject JavaScript into the page which just finished loading. */
browser.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
/*
read elements in content_html
*/
}
});
browser.loadUrl("http://vnexpress.net/gl/rss/");
}
final Context myApp = this;
Builder builder;
String content_html;
/* An instance of this class will be registered as a JavaScript interface */
class MyJavaScriptInterface
{
#SuppressWarnings("unused")
public void showHTML(String html)
{
builder = new AlertDialog.Builder(myApp);
builder.setTitle("HTML")
.setMessage(html)
.setPositiveButton(android.R.string.ok, null)
.setCancelable(false)
.create()
.show();
content_html = html;
Log.i("html", html+" ");
}
}
Try this one that work for me
class MyJavaScriptInterface
{
#SuppressWarnings("unused")
public void showHTML(String html)
{
System.out.println("Html...."+html);
}
}
In Activity
browser.getSettings().setJavaScriptEnabled(true);
browser.getSettings().setPluginsEnabled(true);
browser.getSettings().setSupportZoom(true);
browser.getSettings().setBuiltInZoomControls(true);
browser.setBackgroundColor(Color.TRANSPARENT);
browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
browser.setWebViewClient(new WebViewClient() {
#Override
public void onPageFinished(WebView view, String url)
{
browser.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
}
});
browser.loadUrl(link);