Open Twitter links either in Twitter app or system browser

Still working on a Twitter feed in my app. Each tweet in the app links to the tweet on Twitter, currently with the default http URL.

Right now those links open in an in-app browser, but I would like the app to check if the user has the Twitter app installed - if yes, open the twitter:// URL in the user’s Twitter app, if not, open it in the user’s system browser (instead of in-app). But I can’t seem to get it to work even with target="_blank" in the <a> tag. (Or maybe this is just an issue with the Ionic Dev App?)

As for the twitter links, I tried doing it like this:

setUrl(...) {
  if(window.open("twitter://..." == null) {
    return("http://...");
  } else {
    return("twitter://...");
}

// ...

this.url = this.setUrl(...);

And then use <a href="{{ url }}"> in my HTML. But then the app actually tries to load the url in-app when I load the twitter page and I’m just getting errors.

Anyone able to help me with this? :thinking: