Skip to content

Commit 7424dca

Browse files
Fix beforeLoad not being called in some requests - initially reported in apache#686
The waitForBeforeload flag was preventing beforeLoad from being called on every GET request.
1 parent 9c9587c commit 7424dca

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/android/InAppBrowser.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,6 @@ else if (action.equals("loadAfterBeforeload")) {
269269
@SuppressLint("NewApi")
270270
@Override
271271
public void run() {
272-
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.O) {
273-
currentClient.waitForBeforeload = false;
274-
inAppWebView.setWebViewClient(currentClient);
275-
} else {
276-
((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
277-
}
278272
inAppWebView.loadUrl(url);
279273
}
280274
});
@@ -1169,7 +1163,6 @@ public class InAppBrowserClient extends WebViewClient {
11691163
EditText edittext;
11701164
CordovaWebView webView;
11711165
String beforeload;
1172-
boolean waitForBeforeload;
11731166

11741167
/**
11751168
* Constructor.
@@ -1181,7 +1174,6 @@ public InAppBrowserClient(CordovaWebView webView, EditText mEditText, String bef
11811174
this.webView = webView;
11821175
this.edittext = mEditText;
11831176
this.beforeload = beforeload;
1184-
this.waitForBeforeload = beforeload != null;
11851177
}
11861178

11871179
/**
@@ -1242,7 +1234,7 @@ public boolean shouldOverrideUrlLoading(String url, String method) {
12421234
}
12431235

12441236
// On first URL change, initiate JS callback. Only after the beforeload event, continue.
1245-
if (useBeforeload && this.waitForBeforeload) {
1237+
if (useBeforeload) {
12461238
if(sendBeforeLoad(url, method)) {
12471239
return true;
12481240
}
@@ -1337,9 +1329,6 @@ else if (!url.startsWith("http:") && !url.startsWith("https:") && url.matches("^
13371329
}
13381330
}
13391331

1340-
if (useBeforeload) {
1341-
this.waitForBeforeload = true;
1342-
}
13431332
return override;
13441333
}
13451334

0 commit comments

Comments
 (0)