科尔多瓦无法访问外部脚本,文件,图像 [英] cordova cant access external scripts, files, images

查看:61
本文介绍了科尔多瓦无法访问外部脚本,文件,图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这真让我发疯.

我有两个版本的应用程序,一个准系统版本和一个高级版本.我弄乱了高级版本中的一些模块/插件,因此我从头开始在一个新目录中重建了它.将所有必要的www/js/img文件夹复制到新创建的文件夹中.

I have two versions of my app, a barebones version and an advanced version. I messed up some modules/plugins in the advanced version so I rebuilt it from scratch in a new directory. Copied all the necessary www/js/img folders to the newly created one.

我确认我已经安装了所有相同的插件,模块和软件包-然后,我能够成功构建该应用程序并成功运行它.但是,任何对外部脚本或文件的引用在控制台日志上都会出现"404(未找到)"错误.准系统应用程序仍然可以插入google maps脚本,并且我已经比较了两个config.xml文件,看不到任何会引起问题的东西.

I verified i have installed all the same plugins, modules and packages - I then am able to build the app successfully and run it successfully. However, any reference to external scripts or files are getting a "404 (Not Found)" error on the console logs. The barebones app can still pull in the google maps script and I have compared the two config.xml files and can't see anything that would cause an issue.

其中一个在index.html中:

One is in the index.html:

另外一个是从IONIC网站加载的jpg图像,这是其标准标签模板的一部分.

And the other are jpg images loaded from the IONIC website - part of their standard tabs template.

我得到的错误: 无法加载资源:服务器回复状态为404(未找到) http://maps.google.com/maps/api/js?sensor=false&

The errors I am getting: Failed to load resource: the server responded with a status of 404 (Not Found) http://maps.google.com/maps/api/js?sensor=false&

GET https://pbs.twimg.com/profile_images/514549811765211136/9SgAuHeY.png 404(未找到)ionic.bundle.js:11568 ...以及另外5个与此类似的img png/jpg错误.

GET https://pbs.twimg.com/profile_images/514549811765211136/9SgAuHeY.png 404 (Not Found) ionic.bundle.js:11568 ...and 5 more img png/jpg errors similar to this one.

在我的生命中,我无法弄清楚为什么不允许新构建的应用程序提取外部文件或脚本.任何帮助都将不胜感激.

For the life of me I cant' figure out why the newly rebuilt app isn't allowed to pull in external files or scripts. Any and all help is appreciated.

在config.xml文件中,我定义了以下内容:

In my config.xml file I have the following defined:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.testapp765534" 
  version="0.0.1" xmlns="http://www.w3.org/ns/widgets" 
  xmlns:cdv="http://cordova.apache.org/ns/1.0"
  xmlns:android="http://schemas.android.com/apk/res/android">
  <name>TestApp</name>
  <description> 
    A test mapping app. 
  </description>
  <author href="http://testapp.org/" email="info@testapp.org"> 
    testapp DEV TEAM
  </author>
  <access origin="*" />
  <access origin="http://*.google.com" />
  <allow-intent href="http://*/*" />
  <allow-intent href="https://*/*" />
  <allow-intent href="tel:*" />
  <allow-intent href="sms:*" />
  <allow-intent href="mailto:*" />
  <allow-intent href="geo:*" />
  <content src="index.html"/>
  <platform name="android">
    <allow-intent href="market:*" />
  </platform>
  <preference name="webviewbounce" value="false"/>
  <preference name="UIWebViewBounce" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="BackupWebStorage" value="none"/>
  <feature name="StatusBar">
    <param onload="true" name="ios-package" value="CDVStatusBar"/>
  </feature>
</widget>

为了记录,我还安装了以下插件:

For the record I also have the following plugins installed:

android.support.v4 21.0.1 "Android Support v4"
com.google.playservices 23.0.0 "Google Play Services for Android"
com.ionic.keyboard 1.0.4 "Keyboard"
cordova-plugin-device 1.0.0 "Device"
net.orworks.cordovaplugins.cordovasqlite 1.5.0 "CordovaSQLite"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device-motion 0.2.11 "Device Motion"
org.apache.cordova.device-orientation 0.3.11 "Device Orientation"
org.apache.cordova.dialogs 0.3.0 "Notification"
org.apache.cordova.geolocation 0.3.12 "Geolocation"
org.apache.cordova.globalization 0.3.4 "Globalization"
org.apache.cordova.splashscreen 1.0.0 "Splashscreen"
org.apache.cordova.statusbar 0.1.10 "StatusBar"
org.apache.cordova.vibration 0.3.13 "Vibration"

推荐答案

安装 https://github .com/apache/cordova-plugin-whitelist 此插件即可正常工作.

Install https://github.com/apache/cordova-plugin-whitelist this plugin then it works.

这篇关于科尔多瓦无法访问外部脚本,文件,图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆