@@ -80,6 +80,7 @@ public interface Listener {
80
80
protected WeakReference <Activity > mActivity ;
81
81
protected WeakReference <Fragment > mFragment ;
82
82
protected Listener mListener ;
83
+ protected boolean mAllowSubdomains = true ;
83
84
protected final List <String > mPermittedHostnames = new LinkedList <String >();
84
85
/** File upload callback for platform versions prior to Android 5.0 */
85
86
protected ValueCallback <Uri > mFileUploadCallbackFirst ;
@@ -340,6 +341,14 @@ public void addHttpHeader(final String name, final String value) {
340
341
public void removeHttpHeader (final String name ) {
341
342
mHttpHeaders .remove (name );
342
343
}
344
+
345
+ public void setAllowSubdomains (boolean b ){
346
+ mAllowSubdomains = b ;
347
+ }
348
+
349
+ public boolean getAllowSubdomains (){
350
+ return mAllowSubdomains ;
351
+ }
343
352
344
353
public void addPermittedHostname (String hostname ) {
345
354
mPermittedHostnames .add (hostname );
@@ -503,7 +512,7 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
503
512
504
513
@ Override
505
514
public boolean shouldOverrideUrlLoading (final WebView view , final String url ) {
506
- if (!isPermittedUrl (url )) {
515
+ if (!isPermittedUrl (url , mAllowSubdomains )) {
507
516
// if a listener is available
508
517
if (mListener != null ) {
509
518
// inform the listener about the request
0 commit comments