X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Factivities%2FMainWebViewActivity.java;h=97362dfe9cf5db1dda2d3d25ebecf4fac883d46b;hp=74cb432adc57ff185ca2e10b2f4cdb8e46917c57;hb=80187b7215a5effdbe97ac48e8af34824a05c287;hpb=07c283834aa292605e1ba462a76ceb5ff619c453 diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 74cb432a..97362dfe 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -1122,10 +1122,16 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.startsWith("http")) { // Load the URL in Privacy Browser. + // Hide the WebView while applying domain settings so changes to things like JavaScript aren't rendered on the current URL, which otherwise will reload automatically. + mainWebView.setVisibility(View.INVISIBLE); + // Apply the domain settings for the new URL. applyDomainSettings(url, true, false); - // Returning false causes the current `WebView` to handle the URL and prevents it from adding redirects to the history list. + // Display the WebView again so that the new URL can be loaded. + mainWebView.setVisibility(View.VISIBLE); + + // Returning false causes the current WebView to handle the URL and prevents it from adding redirects to the history list. return false; } else if (url.startsWith("mailto:")) { // Load the email address in an external email program. // Use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched.