Assets not found by Cordova/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.

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>

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.

Inspecting the app in Safari shows the url of the resources are, for example, file:///css/app.css.

Why is it that when I serve the project it works but not on device?

Answers:

Answer

I found the answer was that someone had introduced

<base href="/">

and I needed

<base href=".">

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.