Java Code Examples for android.webkit.WebView#clearHistory()
The following examples show how to use
android.webkit.WebView#clearHistory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgentWebUtils.java From AgentWeb with Apache License 2.0 | 6 votes |
static void clearWebViewAllCache(Context context, WebView webView) { try { AgentWebConfig.removeAllCookies(null); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); context.deleteDatabase("webviewCache.db"); context.deleteDatabase("webview.db"); webView.clearCache(true); webView.clearHistory(); webView.clearFormData(); clearCacheFolder(new File(AgentWebConfig.getCachePath(context)), 0); } catch (Exception ignore) { //ignore.printStackTrace(); if (AgentWebConfig.DEBUG) { ignore.printStackTrace(); } } }
Example 2
Source File: SystemWebViewClient.java From cordova-plugin-app-update-demo with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 3
Source File: SystemWebViewClient.java From app-icon with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 4
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 5
Source File: SystemWebViewClient.java From countly-sdk-cordova with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 6
Source File: SystemWebViewClient.java From chappiecast with Mozilla Public License 2.0 | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 7
Source File: WebViewSignInActivity.java From android-AutofillFramework with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login_webview_activity); WebView webView = findViewById(R.id.webview); WebSettings webSettings = webView.getSettings(); webView.setWebViewClient(new WebViewClient()); webSettings.setJavaScriptEnabled(true); String url = getIntent().getStringExtra("url"); if (url == null) { url = "file:///android_res/raw/sample_form.html"; } if (DEBUG) Log.d(TAG, "Clearing WebView data"); webView.clearHistory(); webView.clearFormData(); webView.clearCache(true); Log.i(TAG, "Loading URL " + url); webView.loadUrl(url); }
Example 8
Source File: SystemWebViewClient.java From BigDataPlatform with GNU General Public License v3.0 | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 9
Source File: SystemWebViewClient.java From cordova-plugin-intent with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 10
Source File: SystemWebViewClient.java From ultimate-cordova-webview-app with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 11
Source File: CallActivity.java From sealrtc-android with MIT License | 6 votes |
public void destroyWebView(WebView mWebView) { if (mWebView != null) { try { ViewParent parent = mWebView.getParent(); if (parent != null) { ((ViewGroup) parent).removeView(mWebView); } mWebView.stopLoading(); mWebView.getSettings().setJavaScriptEnabled(false); mWebView.clearHistory(); mWebView.clearView(); mWebView.removeAllViews(); mWebView.destroy(); } catch (Exception e) { e.printStackTrace(); } } }
Example 12
Source File: SystemWebViewClient.java From xmall with MIT License | 6 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } parentEngine.client.onPageFinishedLoading(url); }
Example 13
Source File: MoviePlayingState.java From TubiPlayer with MIT License | 5 votes |
private void hideVpaidNShowPlayer(final PlayerUIController controller) { controller.getExoPlayerView().setVisibility(View.VISIBLE); WebView vpaidEWebView = controller.getVpaidWebView(); if (vpaidEWebView != null) { vpaidEWebView.setVisibility(View.GONE); vpaidEWebView.loadUrl(VpaidClient.EMPTY_URL); vpaidEWebView.clearHistory(); } }
Example 14
Source File: ThemeFragment.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
@Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (startsWith(url, mUrl) && !mLoadingFinished) { mLoadingFinished = true; view.removeCallbacks(mPageLoadingTimeoutHandlerTask); mOnErrorUrl = null; mUrl = null; } else if (mUrl == null) { view.setWebViewClient(getWebViewClient()); mLoadingFinished = true; } view.clearHistory(); //tryScrollToElement(); }
Example 15
Source File: CordovaWebViewClient.java From phonegapbootcampsite with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Example 16
Source File: CordovaWebViewClient.java From reader with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls. if (!isCurrentlyLoading) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Example 17
Source File: CordovaWebViewClient.java From IoTgo_Android_App with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls. if (!isCurrentlyLoading) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Example 18
Source File: CordovaWebViewClient.java From bluemix-parking-meter with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls, if url is not about:blank (CB-8317). if (!isCurrentlyLoading && !url.startsWith("about:")) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Example 19
Source File: CordovaWebViewClient.java From CordovaYoutubeVideoPlayer with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls. if (!isCurrentlyLoading) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }
Example 20
Source File: CordovaWebViewClient.java From reader with MIT License | 4 votes |
/** * Notify the host application that a page has finished loading. * This method is called only for main frame. When onPageFinished() is called, the rendering picture may not be updated yet. * * * @param view The webview initiating the callback. * @param url The url of the page. */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // Ignore excessive calls. if (!isCurrentlyLoading) { return; } isCurrentlyLoading = false; LOG.d(TAG, "onPageFinished(" + url + ")"); /** * Because of a timing issue we need to clear this history in onPageFinished as well as * onPageStarted. However we only want to do this if the doClearHistory boolean is set to * true. You see when you load a url with a # in it which is common in jQuery applications * onPageStared is not called. Clearing the history at that point would break jQuery apps. */ if (this.doClearHistory) { view.clearHistory(); this.doClearHistory = false; } // Clear timeout flag this.appView.loadUrlTimeout++; // Broadcast message that page has loaded this.appView.postMessage("onPageFinished", url); // Make app visible after 2 sec in case there was a JS error and Cordova JS never initialized correctly if (this.appView.getVisibility() == View.INVISIBLE) { Thread t = new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { appView.postMessage("spinner", "stop"); } }); } catch (InterruptedException e) { } } }); t.start(); } // Shutdown if blank loaded if (url.equals("about:blank")) { appView.postMessage("exit", null); } }