7

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.

1 Answer 1

8

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

Sign up to request clarification or add additional context in comments.

5 Comments

I saw your video. That is based on cordova plugin.I am Ionic 3 PWA Developer. i will not access cordova plugin. my requirement is ionic PWA link to website and return to PWA for browser(firefox or chrome). have you any idea?
Try it so window.open("https://www.w3schools.com/php/",'_system', 'location=yes');
Working fine but website is open popup. is it correct way?
if you wont open browser view in yours app use InAppBrowser Plugin, I have no other idea
Thanks for reply.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.