Allowing Images to Display in the Mobile Client or Apache Cordova apps



In Web applications, it is typical to use relative paths for resources, such as images.  However, these relatives paths will not work if your application is running locally on a mobile device, while the images are located on the server.  Profound UI provides a simple solution to resolve the correct path based on the environment the application is running in (directly on the server vs. locally on a mobile device).

On the Mobile Client, Profound UI resolves all common properties that require a resource path automatically.  However, if you're specifying a path using custom JavaScript code or through the use of Apache Cordova, you must manually resolve it through a built-in API called pui.normalizeURL(). For Cordova applications, it can be used in combination with property scripting in Profound UI. For example, when using a background image in a Cordova application, instead of specifying the image location as

/images/background.png

You would use

js: pui.normalizeURL("/images/background.png")

For dynamic paths bound to a server-side variable, you can use the Normalize URL formatting option as demonstrated below: