Skip to content

Using Messenger on Desktop

Murhaf Sousli edited this page May 31, 2024 · 4 revisions

While the Messenger share button works without issues on Mobile, it won't work out of the box on desktop like the rest of the share buttons, FB requires setting special parameters in the sharer URL.

To make Messenger button work on desktop, you will need to set the app_id and the redirectUrl.

Setting the app_id:

You can either add the meta tag in your index.html, for example:

<head>
  <meta property="fb:app_id" content="YOUR_FB_APP_ID"/>
</head>

Or using the global config:

import { provideShareButtonsOptions, withConfig } from 'ngx-sharebuttons';

export const appConfig: ApplicationConfig = {
  providers: [
    provideShareButtonsOptions(
      withConfig({
        messengerAppId: 'YOUR_FB_APP_ID'
      })
    )
  ]
};

Setting the redirectUrl:

The redirectUrl should be set using the component input [redirectUrl]:

<share-buttons [redirectUrl]="messengerRedirectUrl"/>