0

We have a website that has a component with share links for multiple different social media services (facebook, twitter, xing, linkedin). Now we want the mobile version of the page to use the custom protocol for each social media service (if applicable), so that clicking on any of the links will open the corresponding app.

After spending a long time with searching on google we could confirm three of the protocols. facebook uses fb://
twitter uses twitter://
linkedin uses linkedin://
For xing we couldn't find anything, but it should probably be xing://, if the app actually supports custom protocols.

What is still completely unclear is what the complete URLs should look like. Or if the sharing features could actually be used with custom protocols since the only examples I could find would open a persons or companies face book page. There's also this example snippet using the whatsapp:// custom protocol:

'whatsapp://send?text=' + {title} + ':%20' + {URL}

This is what the actual sharing URLs look like (with {} containing placeholders)

'https://www.facebook.com/sharer/sharer.php?u=' + {URL} + '&t=' + {title}
'https://twitter.com/intent/tweet?source=' + {URL} + '&text=' + {title} + ':%20' + {URL}
'https://www.xing.com/spi/shares/new?url=' + {URL} + ';title=' + {title} + ':%20' + {}
'http://www.linkedin.com/shareArticle?mini=true&url=' + {URL} + '&title=' + {title} + ':%20' + {URL}

This is what I came up with based on the protocols listed above and the custom protocol snippet for whats app. Basically I just replaced the https:// with the protocol and dropped the domain.

'fb://sharer/sharer.php?u=' + {URL} + '&t=' + {title}
'twitter://intent/tweet?source=' + {URL} + '&text=' + {title} + ':%20' + {URL}
'xing://spi/shares/new?url=' + {URL} + ';title=' + {title} + ':%20' + {}
'linkedin://shareArticle?mini=true&url=' + {URL} + '&title=' + {title} + ':%20' + {URL}

I did a short test on browser stack, but only got the facebook app to open, which doesn't necessarily mean, that the URL is correct, as I didn't have an account at hand. I would assume the other apps were simply not installed, so I will try to organize a physical device and social media accounts tomorrow.

I would appreciate it if someone could tell me, if I'm moving towards the right direction or if I'm about to burn quite some time on something that might not be possible as we imagined.

EDIT: After spending some more time on it, I stumbled over this post: https://stackoverflow.com/a/51239012/11891109 which works fine for facebook. But also keep in mind, that this solution might break at any time, when facebook makes changes to their app (https://stackoverflow.com/a/49881656/11891). For the other social media services we stoppped trying, since we couldn't find more information. Even in the case of the fb:// protocol it's an undocumented feature.

  • 1
    There is no guarantee that the https-url and the app url has anything in common. You need to read the documentation for each company to see what the recommended way is – WizKid Aug 06 '19 at 19:49
  • I find https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share much more intriguing, than having to deal with loads of custom protocols. (Not necessarily production ready yet, but I like the idea.) – misorude Aug 07 '19 at 06:39

0 Answers0