I want open this link (http://e-sign-poc.s3-website-us-west-2.amazonaws.com/) like mobile browser using webview
mWebview = (WebView) findViewById(R.id.wb_sample);
WebSettings webSettings = mWebview.getSettings(); webSettings.setJavaScriptEnabled(true);
mWebview.setWebChromeClient(new WebChromeClient());
mWebview.setWebViewClient(new WebViewClient());
mWebview.loadUrl("http://e-sign-poc.s3-website-us-west-2.amazonaws.com/");
This link not loading properly in webview, but this link works perfectly in telegram webview
Wait for some time after you load URL to WebView
It will work perfectly in my device
or
Try with this code
url = "http://e-sign-poc.s3-website-us-west-2.amazonaws.com/" +
"";
linearLayout.setVisibility(View.GONE);
webView.setVisibility(View.VISIBLE);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.loadUrl(url);
Try with it -
webView = (WebView) findViewById(R.id.wvTest);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
webView.setWebViewClient(new WebViewClient(){
#Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
progressBar.setProgress(view.getProgress());
}
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
progressBar.setVisibility(View.VISIBLE);
}
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progressBar.setVisibility(View.GONE);
}
});
webView.loadUrl("https://www.example.com");
Related
I'm opening a WebView with static html in my Android app. The html contains a link as well which currently gets opened in the system browser, i.e. the app is put in the background. How can I achieve opening that link in the WebView itself? I tried it with
webView.setWebViewClient(new WebViewclient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
// gets never called
}
}
but that method is never called.
Try this it works for you.
private void loadWebView() {
webView = (WebView) view.findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setDomStorageEnabled(true);
final ProgressDialog pd = ProgressDialog.show(getActivity(), "", "Loading...", true);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://yourWeb.com/");
webView.setWebViewClient(new WebViewClient() {
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
pd.show();
}
#Override
public void onPageFinished(WebView view, String url) {
try {
pd.dismiss();
} catch (Exception e) {
}
}
});
}
WebView = (WebView) findViewById(R.id.activity_main_webview);
WebSettings webSettings = WebView.getSettings();
webSettings.setJavaScriptEnabled(true);
WebView.loadUrl("http://zzzzzz.com/");
WebView.setWebViewClient(new com.barometer.app.MyAppWebViewClient(){
#Override
public void onPageFinished(WebView view, String url) {
//hide loading image
findViewById(R.id.progressBar1).setVisibility(View.GONE);
//show webview
findViewById(R.id.activity_main_webview).setVisibility(View.VISIBLE);
}});
The code can only call the web with the mobile version. I want to call my web amp. How to?
My website has login control. If the user has logged in a different text, If the user has not logged in a different text.
I want to print on the screen.
Here is the code
WebView mWebView = (WebView) findViewById(R.id.Wview);
assert mWebView != null;
mWebView.getSettings().setJavaScriptEnabled(true);
WebSettings webSettings = mWebView.getSettings();
webSettings.setDefaultTextEncodingName("utf-8");
webSettings.setAllowFileAccess(true);
mWebView.loadUrl("http://arkadasimabakarmisin.com/");
mWebView.setWebViewClient(new WebViewClient() {
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon)
{
view.loadUrl("javascript:document.getElementsByClassName(\"page-wrapper\")[0].setAttribute(\"style\",\"display:none;\"); " );
}
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
//
view.loadUrl("javascript:document.getElementsByClassName(\"page-wrapper\")[0].setAttribute(\"style\",\"display:none;\"); " );
}
});
I have a simple webview ,nothing complex
URL = getIntent().getExtras().getString(FinalVariables.LOAD_URL);
mWebView =(WebView) findViewById(R.id.mywebview);
progressBar = (ProgressBar)findViewById(R.id.progressbar);
if(!TextUtils.isEmpty(URL))
mWebView.loadUrl(URL);
mWebView.setWebViewClient(new WebViewClient() {
#Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
progressBar.setVisibility(View.VISIBLE);
}
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progressBar.setVisibility(View.GONE);
}
});
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
But for some reason if the opened page has a video in it, it won't get played
this is what I am seeing now.But when I run this same code on sony device,no problems there.I tried enabling the android:hardwareAccelerated="true" in AndroidManifest.xml but didn't work.Any help is appreciated.
I found a solution for this and was quite simple.Adding a single line on shouldOverrideUrlLoading fixed the problem ie,
mWebView.setWebChromeClient(new WebChromeClient());
Hope this will help someone.
I have a browsable webview but unfortunately when I open a new page inside the webview i loose the login state and have to login again.
here my code:
wv = (WebView) findViewById(R.id.webArea);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
CookieManager.setAcceptFileSchemeCookies(true);
}
CookieSyncManager.createInstance(Home.this);
CookieSyncManager.getInstance().startSync();
dialog = new ProgressDialog(this);
dialog.setMessage("Loading");
dialog.setCanceledOnTouchOutside(false);
dialog.show();
wv.getSettings().setDatabaseEnabled(true);
wv.getSettings().setAllowFileAccess(true);
wv.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
wv.getSettings().setJavaScriptEnabled(true);
wv.getSettings().setLoadsImagesAutomatically(true);
wv.setWebViewClient(new WebViewClient() {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
dialog.show();
view.loadUrl(url);
return true;
}
#Override
public void onPageFinished(WebView view, String url) {
if (dialog.isShowing()) {
dialog.dismiss();
}
}
});
wv.loadUrl(url);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDatabaseEnabled(true);
webSettings.setAllowFileAccess(true);
What's wrong?
Try this to set cookieSyncManager -
CookieSyncManager.createInstance(mWebView.getContext());
If doesn't work, then we will have to check how your URL navigates.