Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With version 2.7.3 of the iOS mobile client, an internal configuration change needed to be made that had the side effect of causing hyperlinks to open inside the mobile client WebView instead of in the system web browser (Safari). Depending on the circumstances, this may be undesirable. To work around this, some JavaScript code can be used to listen for hyperlink "clicks" and, when desired, open them in the system browser. Below is some sample code that can be customized and either placed in the `profounduiprofoundui/userdata/extension/mobile` directory mobile directory (to affect every mobile session) or attached to individual rich displays (via the external javascript property or the display's onload event).

...

LineDescription
1

Add a "click" event listener to intercept every click made on the screen.

2

Filter out clicks to everything except anchor tags (hyperlinks).

3

Define the `click` click variable for convenience and readability.

4

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` system is used by the Inin-Appapp-Browser browser Cordova plugin to denote a URL that should open in the system browser.

5

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.

6Open the desired URL in the system web browser – the "in-app-browser" plugin included with the Profound UI mobile client overrides `windowwindow.open()` and causes URLs with a target of `_system` system to open in the system web browser.
10The 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 `clickPatchclickPatch.js`js. This more easily allows breakpoints to be added and code to be inspected.

...