Adding Local Resources to a Mobile Workflow Project

When loading resources using custom JavaScript, be aware of the folder structure.

Depending on localization, the structure and path to the local resource may be different. Possible folder paths include:
  • .../html/default/workflow.html
  • .../html/{locale}/workflow.html
  • .../html/workflow.html

Referencing custom resources in HTML elements requires the use of relative URLs. The parent directory may be the HTML directory, the root, or something else. There is no guarantee that the URL structure is always http://hostname/html/workflow.html. It is possible to copy the resources into each localization directory or reference the resources from one directory (paying attention to localization paths).

An example of a useful helper function to get the relative path to the HTML directory is:

/**
 * Returns relative URL to the html directory
 */
function getRelativeRoot()
{
   return ((resources != null) ? "../" : ""
}

// Helper function usage
var imageElement = document.getElementById("ImageElement");
imageElement.src = getRelativeRoot() + "images/myImage.gif";