When I click the Facebook Share link on the web, I want to go to the app if there is an app on mobile

Viewed 36
function shareFacebook() {
    let url = encodeURIComponent('https://stackoverflow.com/');
    let title = 'title';
    window.open(`http://www.facebook.com/sharer.php?u=${url}&t=${title}`, 'pop up name', 'width=600, height=600');
  }

return (
   <button onClick={() => shareFacebook()}><img src={facebook}></img></button>
)

The code for now is the PC version. The url is stack overflow, and when you click the button, you will be directed to the page shared on Facebook.

But I want to make one more responsive button, and when the responsive button is clicked, it will go to the facebook app and even share the url on stackoverflow. But I don't know what to do.

function shareFacebook() {
    let url = encodeURIComponent('https://stackoverflow.com/');
    let title = 'title';
    window.open(`fb://sharer.php?u=${url}&t=${title}`, 'pop up name', 'width=600, height=600');
  }

I've tried this, and when I click the Facebook link in Responsive, I go to the app, but it doesn't go to the page sharing stack overflow.

0 Answers
Related