Cordova / Phonegap找不到的资源 [英] Assets not found by Cordova/Phonegap
问题描述
我刚刚将我的HTML5应用程序移植到Phonegap,这是因为我有一个HTML5应用程序,并将其包含在Phonegap要求的结构中。
I have just ported my HTML5 app to Phonegap, that being I had a HTML5 app, and included it in the structure Phonegap requires.
css / js文件,如下所示:
I have a reference to css/js files in the index.html like so:
<link rel="stylesheet" href="css/app.css">
<script src="js/app.js"></script>
当我运行phonegap serve时,网站运行正常,与之前完全一样它找到所有的文件。
当我运行phonegap运行ios应用程序加载在我的设备,但没有JS或CSS。
When I run "phonegap serve" the site runs fine, exactly the same as it did before - and it finds all the files. When I run "phonegap run ios" the application loads on my device but with no JS or CSS.
在Safari中检查应用程序显示的url的资源是,例如,file:///css/app.css。
Inspecting the app in Safari shows the url of the resources are, for example, file:///css/app.css.
为什么当我服务的项目,它工作,但不是在设备上? p>
Why is it that when I serve the project it works but not on device?
推荐答案
我发现答案是有人介绍了
I found the answer was that someone had introduced
<base href="/">
我需要
<base href=".">
这篇关于Cordova / Phonegap找不到的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!