Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force facebook to open link in external browser for smart phones

How can I post a link to my website in a Facebook post, and have it open in the user's external browser when using smartphone app, not Facebook's native browser, which is not displaying properly? My page is http://www.hannabery.com

like image 358
Scotty Gdog Avatar asked May 02 '17 20:05

Scotty Gdog


2 Answers

On Android, you can use Firebase Dynamic Links to let user open specific URLs by external browser. I guess that Android webview is equipped with some Firebase SDKs, so this method only works on Android. User still opens link by in-app browser on iOS.

  1. Create a project and a domain for dynamic links

  2. Manually create the link like: https://DOMAIN.page.link/?link=YOUR_DEST_URL (Or there're many other ways to create links)

For example, post this link on Facebook or Messenger and try it:

https://fugle.page.link/trade-landing-page

Note: Dynamic Links are mainly used to provide consistent and smooth UX across platforms and app installs. This is just a side effect I discovered may help to answer the question, and it may not last long and so should not be taken as the final solution.

like image 103
starshine wang Avatar answered Oct 02 '22 15:10

starshine wang


Hope that this way can help you:

var ifc = document.createElement("div");
ifc.innerHTML = `<iframe src='${browserScheme}${target}' style='width:0;height:0;border:0; border:none;visibility: hidden;'></iframe>`;
document.body.appendChild(ifc);

Full sources and example: https://github.com/huantt/force-open-browser/tree/master

like image 31
Tat Huan Avatar answered Oct 02 '22 14:10

Tat Huan