The Profound UI mobile client app makes it easy for users to access their Profound UI applications from a mobile device, and makes mobile device features such as the camera available to user applications. The underlying technology used in the mobile client is Apache Cordova, an open source development framework that presents Web content on a native application via a WebView. Due to the complexities involved with Cordova, its many plugins, and the iOS and Android operating systems, sometimes issues crop up outside of Profound UI's control that need to be worked around.
Opening hyperlinks in the system browser (iOS only)
Add a "click" event listener to intercept every click made on the screen.
Filter out clicks to everything except anchor tags (hyperlinks).
Define the `click` variable for convenience and readability.
Only continue if the hyperlink has a URL associated with it and the target is something that should open in a new window/tab. Note that this is sample code and you will likely want to tailor this part to fit your needs. In this case, it was determined that other targets should open inside the mobile client's WebView. Note also that the target of `_system` is used by the In-App-Browser Cordova plugin to denote a URL that should open in the system browser.
Prevent the click event from continuing, as it is being handled here. Without this statement the URL will be opened in both the system browser and the WebView.
|6||Open the desired URL in the system web browser – the "in-app-browser" plugin included with the Profound UI mobile client overrides `window.open()` and causes URLs with a target of `_system` to open in the system web browser.|
|10||The sourceURL directive makes it easier to debug embedded code by making it appear as if the code was loaded from a file. In this example, this event code will appear in the developer tools as if it was contained in file `clickPatch.js`. This more easily allows breakpoints to be added and code to be inspected.|