Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to break out of Twitter in-app browser in Android?

I have a typical modern web-app, regularly shared on Twitter. I recently noticed that, when opening our web-app in the Twitter internal browser, localstorage is deactivated, which breaks our app.

How could I break out of the Twitter internal browser and open the page in the default Android browser?

like image 646
Nils Avatar asked Jul 30 '15 14:07

Nils


2 Answers

I haven't tried this but just a suggestion. You could take a look at this and give it a try.

At the end of the article, it says that the external app won't be invoked if triggered without a user gesture but I believe that the limitation won't be there in case of the In-App browser.

like image 152
Pramodh Valavala Avatar answered Sep 22 '22 03:09

Pramodh Valavala


Well, I think it isn't quite easy to say Android via a WebView to open the Chrome Browser as this in-app browser could be a lot different.

What you could try, as mentioned in the article Here is to trigger a click on an anchor which is calling an "pseudo" intent and add the fallback_url .

There isn't much details provided but it could be a possible hack / workaround.

In your HTML

<a href="intent://url/#Intent;scheme=lala;package=com.google.chrome;S.browser_fallback_url=http%3A%2F%2Fyourappurl.com;end" class="open_me">...</a>

And with JS:

$(".open_me").trigger("click");

According to the article

Now the URL will get you to zxing.org if the app could not be found, or the link was triggered from JavaScript without user gesture (or for other cases where we don’t launch an external application.)

If you're lucky it will open the fallback_url, but as mentioned before it is a WebView which isn't the same as the Chrome Browser, therefore it is possible that nothing happens.

like image 41
Fer To Avatar answered Sep 24 '22 03:09

Fer To