How to detect ionic view?


#1

Do anyone know how to detect if an app is being viewed in ionic view ?
Something like platform.is(‘ionic-view’)

  • Ulrik

#2

I recommend you look at this thread. It would appear Ionic has not provided a solution to this. One possible workaround is @lotterfriendsgist here.


#3

Nice thanks, just what I needed :slight_smile:


#4

As of now this answer no longer works as location.href is just localhost:port/index.html!

Absolutely shocking that Ionic doesn’t provide a way to detect this and instead it lies and says platform is “Cordova” when Cordova plugins aren’t available inside IonicView. I don’t understand this choice considering the number of years Ionic has been around.

For those who come across this in the future, I ended up putting a hack together to check the location.href and if the address is the value that it is in IonicView then I know I’m inside IonicView.