Create a facebook share dialog for both mobile and desktop

Recently I ran into some trouble with a FB.ui share dialog, it worked just fine with some browsers but not on chrome/safari and mobile devices.

The fix for making it work in Chrome and Safari was to add display: popup, yet still nothing would happen om mobile devices.

The solution was to use the following code, that checks if it’s a mobile device and instead redirects the user to and creates the share dialog there.

If you have any questions or problems with the code above, don’t hesitate to ask me.

2 Replies to “Create a facebook share dialog for both mobile and desktop”

  1. I have similar issue, I want my users to be able to share with specific people. The web UI share dialog has this ability, but mobile version doesn’t it is annoying. Will try above method though and let you know.

    • Sharing with specific people shouldn’t be a problem with this method. I tested it out on latest iOS and latest Android and had that option. I hope it worked out for you as well? 🙂


E-postadressen publiceras inte. Obligatoriska fält är märkta *