How to use custom build from dojo under file:/// protocol (Cordova/Phonegap)
NickName:user3673815 Ask DateTime:2014-05-25T23:41:57

How to use custom build from dojo under file:/// protocol (Cordova/Phonegap)

I develop a web app using the dojo framework. This app must be loaded by a browser using the file:/// protocol (It will become a Cordova/Phonegap application for Android/iPad). The index.html file looks like:

Head section:

<script type="text/javascript">
    var dojoConfig =  {
        parseOnLoad: true
    }
</script>

<script type="text/javascript" src=""dojo.js"/>

<script type="text/javascript">
  dojo.require("dojox.mobile.parser");
  dojo.require("dojox.mobile");
</script>

Body section:

<script type="text/javascript">
    dojo.require("dojox.mobile.parser");
    dojo.require("dojox.mobile");
</script>

It was taken from IBM lesson (Mobile application development, Part 1: PhoneGap and Dojo Mobile on Android)

So there are two problems:

1) dojo tries to load modules but failed to do it using the file:/// protocol. The HTTP protocol is requiered.

2) In the index.html I use a custom build of dojo made by the web builder. This build consists of a single file which contains modules I need. However these modules must be required which makes the framework try to load them from unexisting files though they has been already loaded in the big custom dojo.js

May be someone knows how to solve these two problems.

Copyright Notice:Content Author:「user3673815」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23857046/how-to-use-custom-build-from-dojo-under-file-protocol-cordova-phonegap

Answers
frank 2014-05-28T12:31:08

Which browser are you testing your code on?\nChrome does not allow multiple domains within a single Html file, due to security concerns.\nTry your code on the firefox browser it should prompt a warning and run the code.\nAlso make sure the index.html file are in the parent directory of the dojo source (dojo library). i.e\n\nyour directory structure should be as shown below\n|--[dojo_source/dojo_library]\n |\n |-index.html.\n\nalso run your code with the file protocol in the browser\nfile://\n\nHope this helps.\n\nAnother alternative is to install a web server. You can try the \"mongoose\" web server which is very light just 136KB in size. Which you can then setup to run your dojo code. I have been using the web server and it has been great for unit testing my code.",


More about “How to use custom build from dojo under file:/// protocol (Cordova/Phonegap)” related questions