PhoneGap / cordova error with RequireJS text plugin

I am trying to get a simple web project launched via PhoneGap . The site uses RequireJS for asynchronous loading of modules. It also has Handlebars templates that are downloaded through the RequireJS text plugin.

A site works fine when it is served from a local HTTP server. However, it is not displayed on the device. Debugging in PhoneGap is complicated (although it can be done to some extent ), but as far as I can tell, the problem is with loading these templates using the RequireJS text plugin.

The Weinre-based debugger provided by PhoneGap displays an error string in the console:

ASallback error: request failed.

Can someone recommend a solution?

+6
source share
2 answers

a text plugin can cause problems when, for example, templates are placed in another domain from the one that javascript is running on. in this case, due to security restrictions in cross-start requests, the plugin will assume that you are loading a compiled version of your templates and adding .js to the file locator.

if you have control over the server, you can check if the wrong path is being requested.

0
source

Use safari to debug the site on your mobile device / simulator, and it should indicate exactly which request does not work on the network tab.

See http://webdesign.tutsplus.com/tutorials/workflow-tutorials/quick-tip-using-web-inspector-to-debug-mobile-safari/

0
source

Source: https://habr.com/ru/post/925104/


All Articles