crdzoba
crdzoba

Reputation: 661

cordova.js not loading in iOS simulator - file:///cordova.js Failed to load resource: The requested URL was not found on this server

I have two projects - a demo project and an actual project. In the demo project, cordova.js (and all the rest of my js and CSS) load correctly. In the actual project, all the links to js and CSS are improperly formatted.

In the demo project, the link to cordova.js looks like (from the Safari inspector): enter image description here

In the actual & broken project, it looks like:

enter image description here

I've been searching and can't tell a difference between the projects. Why would the second project be using the wrong reference to the files?

Upvotes: 3

Views: 1928

Answers (1)

gwest7
gwest7

Reputation: 1653

Are you perhaps using Angular and have <base href="/"> in your index.html file?

If so you will need to remove it and go the URL hashing way. With Angular 2 you do this by adding { useHash: true } in your routing module. See https://angular.io/docs/ts/latest/guide/router.html#!#browser-url-styles for a good how-to and explanation.

With Angular 1 you configure the location provider. See https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes for an explanation and how-to.

Upvotes: 4

Related Questions