-->

IBM Worklight 6.1 - How to open links?

2019-06-12 00:50发布

问题:

I have tried using this WL.App.openURL('link','_blank').

In my app, I have some hyperlinks. Upon clicking a link, it has to load respective pages in the app itself.

How do I accomplish this?

回答1:

You are mis-using the API...

You have 2 options:

  1. Use Cordova's InAppBrowser API

    This way you can display a browser window ontop of the app; when done you tap a button to close it and return to the app. This code snippet works:

    <a href="#" onclick="window.open('http://apache.org', '_blank', 'location=yes')">visit Apache.org</a>;
    
  2. Read the Integrating server-generated pages in hybrid applications training module and inspect the sample project

    This way you can load an external URL within the application's WebView.


For your case option 1 seems the solution to use.