Is it possible to generate a 'share on Facebook' link that opens the native Facebook App on Android/iOS/mobile instead of the web share dialog?

后端 未结 3 1063
遥遥无期
遥遥无期 2020-12-04 17:37

Is it possible to have a share on Facebook link on a website that opens the share dialog in the native App?

Current behavio

3条回答
  •  一个人的身影
    2020-12-04 18:13

    https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share

    You could try this and let the user decide what native app to use when sharing your link.

    It opens the native share-via of the user's device

    const data = {
      title: document.title,
      text: 'Hello World',
      url: 'https://your_site_url',
    }
    
    const shareVia = window.navigator.share(data);
    
    
     
    
    

提交回复
热议问题