Address the issue related to URL validation
This commit is contained in:
parent
b006e00995
commit
bec82d44d4
@ -18,7 +18,7 @@ If you want to create an app that displays the content of a remote website
|
||||
2. open the `MyWebViewClient.java` file and replace `example.com` on line **14** with your custom hostname
|
||||
|
||||
```java
|
||||
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith("example.com")) {
|
||||
if (Objects.requireNonNull(Uri.parse(url).getHost()).endsWith(".example.com")) {
|
||||
```
|
||||
|
||||
### Using a local source
|
||||
|
@ -11,7 +11,7 @@ class MyWebViewClient extends WebViewClient {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
Uri uri = Uri.parse(url);
|
||||
if (uri.getHost() != null && uri.getHost().contains("example.com")) {
|
||||
if (uri.getHost() != null && uri.getHost().endsWith(".example.com")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user