I have just ported my HTML5 app to Phonegap, that being I had a HTML5 app, and included it in the structure Phonegap requires.
我刚刚将我的HTML5应用程序移植到Phonegap,即我有一个HTML5应用程序,并将其包含在Phonegap所需的结构中。
I have a reference to css/js files in the index.html like so:
我在index.html中引用了css / js文件,如下所示:
<link rel="stylesheet" href="css/app.css">
<script src="js/app.js"></script>
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.
当我运行“phonegap serve”时,该网站运行正常,与以前完全一样 - 并且它找到了所有文件。当我运行“phonegap run ios”时,应用程序会加载到我的设备上但没有JS或CSS。
Inspecting the app in Safari shows the url of the resources are, for example, file:///css/app.css.
在Safari中检查应用程序会显示资源的URL,例如file:///css/app.css。
Why is it that when I serve the project it works but not on device?
为什么当我为项目服务时,它可以工作但不在设备上?
1 个解决方案
#1
7
I found the answer was that someone had introduced
我发现答案是有人介绍过的
<base href="/">
and I needed
而我需要
<base href=".">
#1
7
I found the answer was that someone had introduced
我发现答案是有人介绍过的
<base href="/">
and I needed
而我需要
<base href=".">