diff --git a/README.md b/README.md index 3f5cec3..1a3b98f 100755 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/src/main/java/com/example/app/MyWebViewClient.java b/app/src/main/java/com/example/app/MyWebViewClient.java index 9e4ccc6..d4a7f7d 100755 --- a/app/src/main/java/com/example/app/MyWebViewClient.java +++ b/app/src/main/java/com/example/app/MyWebViewClient.java @@ -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; }