I want to make sure to launch inappbrowser only if I am on devices (iOs, Android...), but if I am in browser (local development mode or just a Web App with gulp build), I want to just link to that page with target="_blank".
I am trying to reuse the Ionic 2 code as a Web App. So when I build the app, it will also work in browser desktop. So platform.ready() is not enough for me. As I need to know if user is on desktop browser and I can do something different.
To run your app, all you have to do is enable USB debugging and Developer Mode on your Android device, then run ionic cordova run android --device from the command line. Enabling USB debugging and Developer Mode can vary between devices, but is easy to look up with a Google search.
Here you go., you can use the following function in replacement of your click function.
onClickOfButton(){ // Check If Cordova/Mobile if (this.platform.is('cordova')) { window.location.href = url; }else{ window.open(url,'_blank'); } }
This can be helpful :)
You can use platform.is('core')
, true when on browser. Platform list:
See http://ionicframework.com/docs/v2/api/platform/Platform/ for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With