最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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?

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?

Share Improve this question edited Jul 30, 2015 at 14:39 AST 2116 silver badges18 bronze badges asked Jul 30, 2015 at 14:05 NilsNils 2513 silver badges13 bronze badges 2
  • An example of a site which is able to do so is dribbble. – Nils Commented Aug 8, 2015 at 3:14
  • Would this help? stackoverflow./questions/3204305/… – Swiffy Commented Aug 11, 2015 at 11:16
Add a ment  | 

3 Answers 3

Reset to default 3 +25

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.

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=.google.chrome;S.browser_fallback_url=http%3A%2F%2Fyourappurl.;end" class="open_me">...</a>

And with JS:

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

According to the article

Now the URL will get you to zxing 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.

You can use a iFrame in your HTML like this:

<iframe src="url." width="900" height=400"></iframe>
发布评论

评论列表(0)

  1. 暂无评论