How to add an extra page inside existing file in webview? - android

I am now working on with the webview process, i have successfully coded to save the webview contents in my app. But, now while saving my webview content, i need to add a extra page to the existing view inside the webview. I searched quite through several links, stil i can't get an idea.
Below is my code:
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSaveFormData(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.getSettings().setSavePassword(false);
final MyJavaScriptInterface myJavaScriptInterface = new MyJavaScriptInterface(
this);
webView.addJavascriptInterface(myJavaScriptInterface, "Textview");
webView.setWebViewClient(new myWebClient());
webView.loadUrl("https://www.google.com/");

Related

Android WebView can't display jquery-fullpage page properly

The page is implemented by jquery-fullpage plugin, like this:
http://alvarotrigo.com/fullPage/#firstPage
In android app, WebView doesn't display it properly. It overlaps all the sub pages in one page without scrollbar.
Any idea?
Version of your browser maybe affect. Check issue on Github.
Remember enable javascript in your WebView:
WebView webView = (WebView) findViewById(R.id.webview);
webView = (WebView) findViewById(R.id.webview);
webView.clearCache(true);
webView.clearHistory();
/* Enabling javascript */
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

How to add local css file to a page in WebView?

So, I have a WebView showing page from url:
WebView webView = (WebView) findViewById(R.id.showContentWebView);
String url = "http://edition.cnn.com/2014/02/05/sport/shaun-white-sochi-slopestyle/index.html";
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl(url);
And I also have a file "style.css" in my assets folder. How can I display the page in WebView with style.css connected?
I think this is possible only if you somehow process the HMTL content, adding a link to your css file. In this case, please refer to this question.

Facebook Login inside webpage on Webview not working

I have a opening a webpage inside webview and trying to login into it using facebook login option, but failed with blank screen inside webview.
on PageFinish() under WebViewClient showing page https://m.facebook.com/dialog/oauth?redirect_uri=http%3A%2F%2......... is loaded but failed to show redirected url
I am using
webView.getSettings().setJavaScriptEnabled(true);
webView.clearCache(true);
webView.clearHistory();
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.loadUrl("http://www.xyz.com/");
webView.setWebViewClient(new MyWebViewClient(this));
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.addJavascriptInterface(new WebAppInterface(this), "HTMLOUT");
Help it out
Thank you.
As of October 2013, facebook no longer allows apps to login via custom webviews.
Per this blog post, they want you to use the SDKs.

How to display image in webview android?

I am working on android. I am trying to display the page data in webview. i.e actually i am getting the data from php webservice. The result of that php webservice is
a document with images and text.(If we right click on that page and view page source it is all the html data). But now what I am doing is I am setting the php link to the webview. So now, it is display fine in webview (same as how it is displaying in webpage). But now the document contains some images which are displaying in website but those images are not displaying in webview. What should I do now? Please help me in this regard.
Code:
WebView webview;
WebSettings settings;
link = "http://.............../page.php?test=123&test1=345"
webview = (WebView) findViewById(R.id.webView1);
settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setPluginState(PluginState.ON);
webview.loadUrl(link);
please add this line,
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);

Can't type inside a WebView

I have a problem interacting with a WebView. I'm showing an HTML login form within a WebView and I can't type inside of any of the input fields of the forms. I do can interact with the links, select boxes, buttons, etc.
Here is an example of my code. Basically I'm retrieving the web view from the xml and setting it a WebViewClient and a WebChromeClient.
webview = (WebView) findViewById(R.id.loginWebview);
webview.getSettings().setJavaScriptEnabled(true);
WebViewClient client = new WebViewClient();
webview.setWebViewClient(client);
webview.setWebChromeClient(new WebChromeClient());
webview.loadUrl("http://www.google.com");
Any ideas?
You can do the following to solve this:
WebView webView = (WebView)findViewById(R.id.yourWebView);
webView.getSettings().setJavaScriptEnabled(true);
webView.requestFocus(View.FOCUS_DOWN);
There is another post here.

Categories

Resources