Step 1 : Ionic create New App. (ionic start myApp1 sidemenu)
Step 2 : Create New Page home and aboutus. (ionic generate page aboutus)
step 3 : Create button at aboutus page for url redirect to another website.
aboutus.html : (<button ion-button (click)="redirect()"> GO » <button>)
aboutus.ts : redirect() { window.open("https://www.w3schools.com/php/", "_self"); }
step 4 : When i click GO button the url redirect to w3schools.com and again browser back button click the redirect to home page only. i need redirect to aboutus page. help me any one.
Use it In App Browser Ionic Native plugin
Install the Cordova and Ionic Native plugins:
ionic cordova plugin add cordova-plugin-inappbrowser
npm install --save @ionic-native/in-app-browser
In app.module.ts add InAppBrowser Provider
import { InAppBrowser } from '@ionic-native/in-app-browser';
providers: [
InAppBrowser,
]
Html:
<ion-buttons>
<button ion-button (click)="redirect()"> GO » <button>
<ion-buttons>
In ts:
import { InAppBrowser } from '@ionic-native/in-app-browser';
constructor(private inAppBrowser: InAppBrowser) {}
redirect() {
this.inAppBrowser.create("https://www.w3schools.com/php/");
}
you can also see this video tutorial