I want to open a specific app page (which developed by using ionic 4) from the device browser button click. Can someone help with it?
3 Answers
You can use ionic's InAppBrowser for that. Here is the link to the plugin https://ionicframework.com/docs/native/in-app-browser
If you want to open within the app, you just need to pass the following parameter while opening,
constructor(
...
private iab: InAppBrowser
) {}
openInAppBrowser(){
this.iab.create(`url`, '_self', {
location: 'no'
});
}
2 Comments
try this window.open(url, target, options);
ref: Reference to the InAppBrowser window. (InAppBrowser)
url: The URL to load (String). Call encodeURI() on this if the URL contains Unicode characters.
target: The target in which to load the URL, an optional parameter that defaults to _self. (String)
_self: Opens in the Cordova WebView if the URL is in the white list, otherwise it opens in the InAppBrowser. _blank: Opens in the InAppBrowser. _system: Opens in the system's web browser. options: Options for the InAppBrowser. Optional, defaulting to: location=yes. (String)
Comments
Just try this,
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'
constructor(private router: Router, private iab: InAppBrowser) { }
openUrl(){
this.iab.create('http://google.com', '_self', {
location:'no'
});
}