Skip to content

Commit bab393a

Browse files
committed
not require only 1 dot in domain
1 parent 1901a14 commit bab393a

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

app/src/main/java/com/webview/myapplication/MainActivity.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {
199199
});
200200
mWebView.loadUrl(STARTUP_URL.isEmpty() ? "https://" + ALLOWED_DOMAINS[0] : STARTUP_URL);
201201
}
202-
203-
private static int countDots(String str) {
204-
return str.split("\\.", -1).length - 1;
205-
}
206-
202+
207203
private class HelloWebViewClient extends WebViewClient {
208204
@Override
209205
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
@@ -213,7 +209,7 @@ public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
213209
isAllowed = true;
214210
}
215211
for (String domain : ALLOWED_DOMAINS) {
216-
if (host.equals(domain) || (countDots(domain) == 1 && (host.equals("www." + domain) || host.equals("m." + domain)))) {
212+
if (host.equals(domain) || host.equals("www." + domain) || host.equals("m." + domain)) {
217213
isAllowed = true;
218214
break;
219215
}

0 commit comments

Comments
 (0)