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);
Related
When I load a url in "Android 7.0",there are some images showing correctly but some images whose url is correct are blank in the emulator.All these images can show correctly in "Android 6.0". This is the code:
webview = new WebView(getApplicationContext());
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setBlockNetworkImage(false);
webview.addJavascriptInterface(new MJavascriptInterface(this,imageUrls), "imagelistener");
webview.setWebViewClient(new MyWebViewClient());
webview.loadUrl(urlStr);
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);
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/");
My webview will works for a site such as Google.com, however, the specific page will not load.
Simply displays subscribe to feedburner (I made this site to reflect a converted news feed)
This specific webpage will display correctly in an Iphone UIWebView, but not for Android.
Some code
WebView rss = (WebView) findViewById(R.id.webviewRSS);
rss.loadUrl("www.newmanu.edu/newmannews");
Check out the source of "www.newmanu.edu/newmannews", you have to activate javascript.
from http://developer.android.com/guide/webapps/webview.html
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
Add http:// or https:// before URL.
Try this.
rss.loadUrl("http://www.newmanu.edu/newmannews");
Or
rss.loadUrl("https://www.newmanu.edu/newmannews");
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.