When writing a Worklight app it is verboten to change the URL of the DOM in which the application is running. This makes sense as a hypertext move to another URL will obliterate the state of the app.
On occasion however, in my app I receive a URL for a news article and the user wishes to read it. Displaying the new content in an iFrame would start to address the requirement, but then I need navigation controls, etc. and it starts to feel like I am reinventing a wheel.
Does Worklight, or one of the mobile JS frameworks provide a "browser in browser" experience that I need here?
Worklight utilizes Cordova. Cordova makes it possible to display just what you wanted, a "browser in a browser" - InAppBrowser.
Try that.
No setup is required as the
InAppBrowser
plug-in is already part of the Worklight project (this may differ depending on your Worklight version; If you are using 6.x you're OK).All you need to do is to call up the URL. For example, in
yourProject\apps\yourApp\common\main.js
:Once the app initializes it will open the InAppBrowser:
And once tapping the
Done
button, you're back in the app.You can of course not specify the
location
attribute so the navigation bar won't display. In that case, in order to go back to the app the user will need to tap theBack
button: