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

时间:2016-04-21 22:49:43

标签: cordova phonegap-cli

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?

1 个答案:

答案 0 :(得分:4)

您是否正在使用Angular并在index.html文件中使用<base href="/">

如果是这样,您将需要将其删除并使用URL哈希方式。使用Angular 2,您可以在路由模块中添加{ useHash: true }。有关详细的操作方法和解释,请参阅https://angular.io/docs/ts/latest/guide/router.html#!#browser-url-styles

使用Angular 1配置位置提供程序。有关说明和操作方法,请参阅https://docs.angularjs.org/guide/ $ location#hashbang-and-html5-modes。