Open link in a new widow fro ion-menu


#1

Hi all, I have a side menu where 1 entry need to be an external link. I have tried with this but without lucky:

<ion-item menu-close class="item item-icon-left item-complex">
              <a class="item-content" href="http://www.ziobuddalabs.it" onclick="window.open(this.href, '_system', 'location=yes');return false;">
                  Lo shop<i class="icon ion-bag"></i>
              </a>
          </ion-item>

The problem is that the externa lsite is not open in new window, but inside the app and I can not go back.

Where is my error ?

Thanks.

M.


#2

You need to include the in-app browser plugin for that style of link to work correctly.


#3

Hi, thanks for the reply but:

$ ionic plugin add cordova-plugin-inappbrowser
Updated the hooks directory to have execute permissions
Fetching plugin "cordova-plugin-inappbrowser" via plugin registry
npm http GET http://registry.cordova.io/cordova-plugin-inappbrowser
npm http 404 http://registry.cordova.io/cordova-plugin-inappbrowser
Error: 404 Not Found: cordova-plugin-inappbrowser
    at RegClient.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:268:14)
    at Request.self.callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:148:22)
    at Request.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:876:14)
    at Request.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:827:12)
    at IncomingMessage.emit (events.js:117:20)
    at _stream_readable.js:943:16
    at process._tickCallback (node.js:419:13)

why ?

CLI v1.4.1

Thanks.

M.


#4

Hi again, I have the solution to my plugin not found error problem:

$ ionic plugin add org.apache.cordova.inappbrowser

npm http GET http://registry.cordova.io/org.apache.cordova.inappbrowser
npm http 200 http://registry.cordova.io/org.apache.cordova.inappbrowser
npm http GET http://cordova.iriscouch.com/registry/_design/app/_rewrite/org.apache.cordova.inappbrowser/-/org.apache.cordova.inappbrowser-0.6.0.tgz
npm http 200 http://cordova.iriscouch.com/registry/_design/app/_rewrite/org.apache.cordova.inappbrowser/-/org.apache.cordova.inappbrowser-0.6.0.tgz
Installing "org.apache.cordova.inappbrowser" for android
Installing "org.apache.cordova.inappbrowser" for ios
Saving plugin to package.json file

Is the 0.6 version ok ?

Thanks.

M.


#5

Try using the cordova cli: cordova plugin add cordova-plugin-inappbrowser

There’s a newer version than 0.6 that fixes some bugs.

But if you can’t figure it out, 0.6 will solve your problem.


#6

The original plugin github link is not updated the install command, actually it should be “cordova plugin add org.apache.cordova.inappbrowser”