12

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

Scotty Gdog
  • 141
  • 1
  • 2
  • 6
  • Unless they're smart enough to disable the Facebook browser themselves, you can't tmk. http://www.androidcentral.com/how-turn-facebooks-app-browser-external-links – NobleUplift May 02 '17 at 20:57
  • Facebook opening external web pages in its own in-app browser, is the contemporary equivalent of late 1990s framed websites opening external links inside a frame on the website. This time around, however, there doesn't appear to be a line or two of javascript which allows for escaping from this setup. – Rounin Apr 03 '18 at 08:56
  • Maybe can detect that browser and show user a message that should open in system browser or it won't work properly. – Zbyszek Aug 03 '18 at 17:11
  • See also https://stackoverflow.com/q/45953870/470749, which links to even more posts about this. – Ryan Oct 10 '19 at 13:52

5 Answers5

7

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.

starshine wang
  • 616
  • 1
  • 8
  • 13
  • This should be the accepted answer. I just tried this and it worked splendidly. – Artokun Dec 27 '19 at 22:56
  • 6
    This doesn't work. FB forcefully open that dynamic link with it's internal browser – sugeesh Jan 03 '20 at 08:47
  • 2
    Worked on Samsung Android, failed on iPad/iPhone. – Tony O'Hagan Feb 04 '21 at 12:56
  • If you are having issues with your PWA not running correctly in Facebooks (insert expletive) Mobile Browser. Using dynamic links will force it out to the regular browser. Don't use your custom domain though. Use https://YOURDOMAIN.page.link instead – Richard Varno Mar 21 '21 at 05:33
  • This only seems to work in messenger. On the normal Facebook news feed it still uses facebooks in-app browser. – RobEW Nov 15 '21 at 11:44
2

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

Jack
  • 49
  • 1
  • 6
1

https://github.com/huantt/force-open-browser/tree/master I thought this one only worked when link is sent on messenger. But any link clicked on fb messenger is going to ask what browser you prefer. I used the code on my page and I posted the link on FB and it is opened by the FB browser. How annoying :(

0

This cant be done (for obvious security reasons) but there are ways

1.Create an app for your website

If you create an app for your website then theres no need for facebook in the middle of things

2.Create an app displaying facebook page

As long as its your page and not something misleading then this is allowed and you can do some pretty neat stuff in android studio

for example if you post a like

mywebsite.com/forum/

theres this cool function you can use .endsWith("/forum/") from there you can make your application do ANYTHING when a link is clicked that ends with "/forum/"

A few things ive done

  1. Redirect to that link
  2. open browser to display link
  3. Move to portion of app
  4. Display dialog boxs

and theres much more your able to do

FlamingGenius
  • 216
  • 3
  • 22
  • Wow, sounds interesting. I know html and css and js, but I've never created an app. Where can I learn more about what you suggested? And thank you! – Scotty Gdog May 04 '17 at 15:50
  • here is a great resource to use https://developer.android.com/guide/webapps/webview.html or if your interested im always available to build an app :) – FlamingGenius May 04 '17 at 17:29
0

If you are having issues with your PWA not running correctly in Facebooks (insert expletive) Mobile Browser. Using dynamic links will force it out to the regular browser. Don't use your custom domain though. Use https://YOURDOMAIN.page.link instead

https://firebase.google.com/docs/dynamic-links/custom-domains

also DO NOT skip the preview page!

Richard Varno
  • 537
  • 6
  • 8