Url to open facebook messenger app if installed, otherwise open web messenger

I am looking for one URL to open a facebook chat session on different devices:

  • On mobile, if fb messenger app is installed, it opens fb-messenger: // user-thread /
  • On a mobile device, if the fb messenger app is not installed, it opens http://m.me/
  • The desktop opens http://m.me/

Example. For google map I just need to use href = "http://www.google.com/maps/place/ {{{{lat}} {{{lng}}}), it will automatically open the google map app if it is installed, otherwise it will open google map in browser.

Thank.

+3


source to share


2 answers


http://m.me/<FACEBOOK_PAGE_USERNAME>

      

For example:



Broadcast football

+12


source


  1. √ On mobile, if fb messenger app is installed, it opens fb-messenger: // user-thread /
  2. √ On a mobile device, if the fb messenger app is not installed, it opens http://m.me/ with a call to action "install messenger"
  3. Opens on the desktop https://m.facebook.com/ ( bad because on mobile )

In short, you need to check if the device is mobile or not:



if(mobile) {
  <a href="https://m.facebook.com/messages/compose?ids=USER_NAME_OR_ID">messenger mobile test</a>
} else {
  <a href="https://m.me/USER_NAME_OR_ID">messenger desktop test</a>
}

      

+2


source







All Articles