Fork me on GitHub

To get this to work in a compiled mobile application (i.e. on your Android or iOS device), you must install the InAppBrowser plugin for your app.

Sometimes we want our Mobile Application to link to an external web page. PhoneGap has an InAppBrowser feature for this, so we can make external links in DrupalGap with these techniques:

Using the l() and bl() Functions

The l() function is shorthand for link. The bl() function is shorthand for button link.

Text Link

var html = dg.l('DrupalGap', '');

Button Link

var html ='DrupalGap', '');

Using a Render Element

var element = {};
element['my_link'] = {
  _theme: 'link',
  _text: 'DrupalGap',
  _path: ''
return element;

You can use either link or button_link for the theme.

Plain HTML Link

<a onclick="'', '_blank', 'location=yes');">DrupalGap</a>

System Browser

It's possible to open links in the user's default browser using the _system target:

var html ='', null, {
    attributes: {
      onclick: "'', '_system', 'location=yes')"