@@ -80,6 +80,7 @@ public interface Listener {
8080 protected WeakReference <Activity > mActivity ;
8181 protected WeakReference <Fragment > mFragment ;
8282 protected Listener mListener ;
83+ protected boolean mAllowSubdomains = true ;
8384 protected final List <String > mPermittedHostnames = new LinkedList <String >();
8485 /** File upload callback for platform versions prior to Android 5.0 */
8586 protected ValueCallback <Uri > mFileUploadCallbackFirst ;
@@ -340,6 +341,14 @@ public void addHttpHeader(final String name, final String value) {
340341 public void removeHttpHeader (final String name ) {
341342 mHttpHeaders .remove (name );
342343 }
344+
345+ public void setAllowSubdomains (boolean b ){
346+ mAllowSubdomains = b ;
347+ }
348+
349+ public boolean getAllowSubdomains (){
350+ return mAllowSubdomains ;
351+ }
343352
344353 public void addPermittedHostname (String hostname ) {
345354 mPermittedHostnames .add (hostname );
@@ -503,7 +512,7 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
503512
504513 @ Override
505514 public boolean shouldOverrideUrlLoading (final WebView view , final String url ) {
506- if (!isPermittedUrl (url )) {
515+ if (!isPermittedUrl (url , mAllowSubdomains )) {
507516 // if a listener is available
508517 if (mListener != null ) {
509518 // inform the listener about the request
0 commit comments