URL Scheme to open Chrome/Firefox (Android OS) from Facebook post

只谈情不闲聊 提交于 2020-06-17 14:16:40

问题


We've a web page that needs to be open in Chrome/Firefox on Android to fully display the content. But when we post the link on Facebook, it always opens the links with its own web browser.

So we're checking if there is a way to force opening the link in Chrome browser from a Facebook post.

Here are some approaches that we tried:

  1. Use Chrome URL Scheme (googlechrome://navigate?url=example.com)

  2. Use window.location.href, window.open (url,"_system"), etc

  3. And even using the intent to launch chrome from the web browser: What is the intent to launch any website link in Google Chrome

If you have any idea or confirmation that there is no way to force users from Facebook Browser to Chrome (Android OS), please let us know.


回答1:


Up until recently the googlechrome://navigate?url=example.com approach worked on both Android/iOS Facebook links when using an href with target="_blank". Recently this stopped working on Android Facebook. The only workaround I have found that works is to use an intent: link that does not specify a package path for Chrome. It will open the link using the default browser, so is not guaranteed to be Chrome. The specific link format that worked was:

window.location = 'intent:https://example.com#Intent;end';

IT appears that the intent is matching a generic URL to use the default selected browser when no package is specified.



来源:https://stackoverflow.com/questions/58229510/url-scheme-to-open-chrome-firefox-android-os-from-facebook-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!