默认情况下Cordova是不能调用外部网址的,需要做一些配置,也是非常简单的。
1、打开圈圈的文件
Paste_Image.png
2、看看框中的的内容在你的工程中有吗?,没有的话加上,一般都是自动生成的。
Paste_Image.png
3、在cordova框架中,有一个类是设置阻止加载外部网页的。点击xcode中的搜索
Paste_Image.png
- 点击框中的<code>CDVIntentAndNavigationFilter
Paste_Image.png
这个方法就是cordova阻止加载外部网页的代码:
Paste_Image.png
只需要将上面方法中的内容更换为:
- (void)parserDidStartDocument:(NSXMLParser*)parser { // file: url <allow-navigations> are added by default // self.allowNavigations = [[NSMutableArray alloc] initWithArray:@[ @"file://" ]]; self.allowNavigations = [[NSMutableArray alloc] initWithArray:@[ @"file://" , @"http://", @"https://", @"xxxxxschemes://"]]; // no intents are added by default self.allowIntents = [[NSMutableArray alloc] init]; }
完活!!!!
Paste_Image.png












网友评论