user6418352
user6418352

Reputation:

How to make a webpage open inside the app when clicked a link in ionic?

I am working on a ionic app and i have some list of website links and want to open it inside the app itself. But when i tried this, it will take to seperate mobile browser. is there any way i can do this? Please help. new to ionic

<div class="list">

      <button class="item button button-assertive">
      <a href="https://www.google.co.in/">
        website 1
      </a> 
      </button>


      <button class="item button button-assertive"> 
      <a href="https://www.google.co.in/">
         website 2
       </a>  
      </button>


      <button class="item button button-assertive"> 
      <a href="https://www.google.co.in/">
         website 3
       </a>  
      </button>


      <button class="item button button-assertive"> 
      <a href="https://www.google.co.in/">
         website 4
       </a>  
      </button>

    </div>

Upvotes: 2

Views: 3710

Answers (1)

user6091811
user6091811

Reputation:

It wont work that way, u need to install cordova in-app browser plugin for that.find it here

once you install the plugin, define a controller in app.js. It will work.

EDIT WITH MORE DESCRIPTION:

Open your nodejs Cmd prompt

cd yourApp

Type

cordova plugin add cordova-plugin-inappbrowser

It will install cordova inapp browser plugin

// Add this to your app.js

.controller("ExampleController", function ($scope) {

$scope.openCordovaWebView = function()
{
  window.open('http://google.com','_self'); 
};

});
// this to your html page

       <ion-content ng-controller="ExampleController">
            <button class="button button-full button-assertive" 
                    ng- click="openCordovaWebView()">
               Website 1
            </button>
        </ion-content> 

Upvotes: 4

Related Questions