Android webview I can't show - android

https://mobilogr.uludag.edu.tr/Login.aspx
I can't open this website in Android webview
WebSettings settings = mWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setUseWideViewPort(true);
settings.setSupportMultipleWindows(true);
settings.setAllowFileAccess(true);
mProgressDialog = ProgressDialog.show(this, "Uygulama Yükleniyor",
"...yükleniyor...");
mWebView.setWebViewClient(new WebViewClient() {
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
if (mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
});
mWebView.loadUrl("https://mobilogr.uludag.edu.tr/Login.aspx");

Please check whether your android Android Manifest for the Internet Permission as shown below
<uses-permission android:name="android.permission.INTERNET" />

Does your application have the permission to go on the internet?
<uses-permission android:name="android.permission.INTERNET" />
also, you want to go to this website,
but your url in your script goes to another?

I have faced the similar issue.
The easiest way is to debug and see, the page may have a broken javascript.
You need to remote debug which give you clear error in console.
Try this : https://developer.chrome.com/devtools/docs/remote-debugging

something is wrong with the certificate.
if your ssl Certificate expired or not trusted,webview will refuse to load the webpage.
To avoid this ,you should override onReceivedSslError method like this:
mWebView.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
// super.onReceivedSslError(view, handler, error);
// ignore ssl error
handler.proceed();
}
});
i try this,everything is OK.

Related

Why did my WebView didn't load the owl-carousel content?

I have a webview that will visit a website, the problem here is that
[it didn't load the entire website content
][1]
Then I tried to use Chrome to access the website, and [it loads all the websites content][2](even though a bit messed up since it viewed in mobile).
When I tried to see the content of the missing things (things that didn't showed up in my WebView), I learned it didn't load the content that use owl-carousel,
Is there a way to let my WebView load the owl-carousel content?
P.s I have activated the javascript too
Here's the codes I create that I think lead to the problem
My Webview settings
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setAllowFileAccessFromFileURLs(true);
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setSupportMultipleWindows(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.getSettings().setBuiltInZoomControls(true);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
And here's my Webview procedure
public class myWebclient extends WebViewClient {
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progressBar.setVisibility(View.GONE);
}
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return super.shouldOverrideUrlLoading(view, url);
}
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
}
Progress Update
I have tried using AdvancedWebview like what Sudheesh R said, but it's still like previous condition nothing changed, it still don't load the owl-carousel content
Update #2
I̶ ̶t̶r̶i̶e̶d̶ ̶u̶s̶i̶n̶g̶ ̶m̶y̶ ̶f̶r̶i̶e̶n̶d̶ ̶W̶e̶b̶V̶i̶e̶w̶ ̶a̶p̶p̶,̶ ̶a̶n̶d̶ ̶i̶t̶ ̶l̶o̶o̶k̶s̶ ̶l̶i̶k̶e̶ ̶i̶t̶ ̶w̶o̶r̶k̶e̶d̶ ̶o̶n̶ ̶h̶i̶s̶ ̶a̶p̶p̶ ̶b̶u̶t̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶k̶n̶o̶w̶ ̶w̶h̶y̶,̶ ̶I̶ ̶w̶i̶l̶l̶ ̶u̶p̶d̶a̶t̶e̶ ̶i̶f̶ ̶I̶ ̶f̶o̶u̶n̶d̶ ̶o̶u̶t̶ ̶h̶o̶w̶.
Alright, I have compared his code with mine, nothing seems comes to light...
Update 3
The only resource I found is this question, but as you see in my code above, I have set the Dom Storage to become enabled... Any help really appreciated
Update 4
Alright, I found out that there's a Jquery method in the website that I haven't initialize yet from my Logcat
So I initialize it but keeping it empty
#JavascriptInterface
public void getxId(){
}
[1]: https://i.stack.imgur.com/3lPNX.png
[2]: https://i.stack.imgur.com/FS6tV.png

android - submit button inside webview not working despite enabling javascript

I want to show a bank website application for paying online .I should use webview , this is my webview code :
WebView wb = (WebView) findViewById(R.id.webView1);
WebSettings settings = wb.getSettings();
settings.setDefaultTextEncodingName("utf-8");
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setSupportZoom(true);
settings.setJavaScriptEnabled(true);
settings.setSaveFormData(false);
settings.setSavePassword(false);
settings.setDomStorageEnabled(true);
progressBar = ProgressDialog.show(Pay.this, Z_Farsi.Convert(getString(R.string.gettingdata)), Z_Farsi.Convert(getString(R.string.wait)));
wb.setWebViewClient(new WebViewClient() {
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
if (progressBar.isShowing()) {
progressBar.dismiss();
}
}
});
The problem is , it's going to a step that I need to click on a button to connect to paying web page . I don't know why it doesn't work and button doesn't press down .
I tested it on android default browser and it worked fine .
Could you help me ? Why does that button is not working on webview?

WebView displays a blank view for certain links

I'm using a webview:
WebView webview = new WebView(this);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setGeolocationEnabled(true);
webview.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
loading.show();
view.loadUrl(url);
return true;
}
#Override
public void onPageFinished(WebView view, final String url) {
loading.dismiss();
super.onPageFinished(view, url);
}
});
For most links, it works just fine. But for, http://m.stubhub.com (and any of the same domain), it only shows a blank view (though it's finished loading the page). Are there settings, I'm missing or something?
Btw, there aren't any errors, as far as I can tell.
Suggestions/advice greatly appreciated. Thanks.
Did you tried onReceivedSslError ? :
public void onReceivedSslError (WebView view, SslErrorHandler handler, SslError error) {
handler.proceed() ;
}
Let me know if that helps !
The solution was the permissions the site required. It uses HTML5 storage, so permission for DOMStorage had to be enabled...
webView.getSettings().setDomStorageEnabled(true);

Flash is not loading in Web view in Android

I am trying to Load a webview in Android. Where web page have a swf file but it is not loading. I know there are many question and answer on same topic but no one helped me.
I have already targeted it version 11. And I have put android:hardwareAccelerated="true" too in manifest.xml file.
My code is here-
public class MainActivity extends Activity {
private WebView mWebView;
String url="http://mypages.com/Ch_001/ScoPage.html";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webView);
mWebView.setKeepScreenOn(true);
WebSettings settings = mWebView.getSettings();
settings.setPluginState(PluginState.ON);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setBuiltInZoomControls(true);
mWebView.setInitialScale(100);
// wbView.getSettings().setUseWideViewPort(true);
mWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setWebViewClient(new MyWebViewClient());
}
private class MyWebViewClient extends WebViewClient {
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
SslError error) {
Log.e("Error VAGARO", error.toString());
handler.proceed();
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
}
}
After one week struggle I got a Flash player from Macromedia, which works for me.
You can search in Google for-"Flash Player 11.1.for Android 4.0 - Macromedia - Adobe" or install APK from this link.
Install this apk in your Android device.
And when you will open it, it will ask for choose default browser.
Choose any browser which support Flash (UC-Browser, Chrome etc).
Now run your any application it will load your Flash video.
Add this code:
webview.getSettings().setPluginsEnabled(true);
add mWebView.loadUrl(url);in onCreate

Loading https getting white screen in android webview in version 2.2

I need to load a https url in android webview but it gets loaded with white screen.
I have also handled public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) but still getting white screen on getting loaded with the url but there are no exceptions in the logcat.
below is my code
public class MainActivity extends Activity {
private static final String URL = "https://someurl";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView)findViewById(R.id.webview);
WebSettings settings = myWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
myWebView.loadUrl(URL);
myWebView.setWebViewClient(new MyWebViewClient());
}
private class MyWebViewClient extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals(URL)) {
return false;
}
Activity that handles URLs
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
super.onReceivedSslError(view, handler, error);
handler.proceed();
}
}
}
Looking forward to your reply.
thanks
There are certain SSL certificates that were not supported in Android 2.2, you can try and check to load it in native browser, if it works on browser then it might be supported. If it is not supported, you have atleast following two options
To change the SSL certificate provider assuming you have admin rights to the website
To implement a work around like SSL not working on Android 2.2 (only in 2.3)
Please check whether the SSL is supported on the other Android versions as well.
handler.proceed(); should make the WebView load the https url, have you tried and load a regular http url,and see if the WebView still is white.
There is a bug in Android rendering the WebView white at times.
Try to disable hardware acceleration on the WebView, set android:layerType="software" attribute on the webview in the .xml layout resource.
<WebView
android:id="#+id/webviev"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:layerType="software" />
mWebview.setWebViewClient(new WebViewClient() {
#Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
super.onReceivedSslError(view, handler, error);
//Error happens here and returns an empty page.
}
On 2.3 devices there is a problem with the certification validation.
It might be valid, but when in incorrect order, it fails.
you can call handler.proceed();
But I don't recommend it ! As it breaks required validation.

Categories

Resources