Phonegap: Source URL is not in Whitelist

前端 未结 4 1789
萌比男神i
萌比男神i 2021-01-06 13:22

I am trying to get PhoneGap 2.4.0 FileTransfer working on Android 4.2.

I get a Logcat warning message saying:

The Source URL is not in white list: \'         


        
相关标签:
4条回答
  • 2021-01-06 13:31

    If you are not using DroidGap, you need:

    Config.init(this);
    

    In the onCreate of your activity. Otherwise, all whitelisting will fail. Just found this out after two hours of painful digging.

    0 讨论(0)
  • 2021-01-06 13:34

    If you are using wild card in the whitelist URL configuration, don't use subdomain property.

    Looks like you have to be very specific in how you write the tags in config.xml especially when it comes to allowing subdomains - apparently specifying subdomains does not work with wildcards so you need two blocks of tags.

    <access origin="*.google.com" />
    <access origin="*.googleapis.com" />
    <access origin="*.gstatic.com" />
    <access origin="*.googleusercontent.com" />
    <access origin="google.com" subdomains="true"/>
    <access origin="googleapis.com" subdomains="true"/>
    <access origin="gstatic.com" subdomains="true"/>
    <access origin="googleusercontent.com" subdomains="true"/>
    
    0 讨论(0)
  • 2021-01-06 13:35

    I managed to fix the problem by using PhoneGap 1.9.0 instead of 2.4.0. The errors return when using later versions.

    I also managed to get it working by not using CordovaWebView but by using PhoneGap build. But this isn't viable in my case.

    0 讨论(0)
  • 2021-01-06 13:43

    It should work if you change your XML to:

    <access origin="*" subdomains="true"/>
    

    This white-lists basically the entire internet. If you only want to white-list your domain, use something more specific. See details here: http://docs.phonegap.com/en/2.4.0/guide_whitelist_index.md.html

    The "origin" attribute is now "uri".

    0 讨论(0)
提交回复
热议问题