DEV Community

Discussion on: How to share anything from your website by Web Share API

Collapse
 
sapinder_dev profile image
Sapinder Singh

In the browsers that don’t support it, you can handle this case by manually copying the link via clipboard api when the user clicks on it.

Collapse
 
j471n profile image
Jatin Sharma

Yeh that's a nice suggestion, thanks for your opinion :)

Collapse
 
marvinbrouwer profile image
Marvin Brouwer

I personally like the scenario where you show a link with an onClick event that prevents browsing so a user can hold(or right click) to get the native share dialog if they desire. And then put a share button next to that with a fallback to the clipboard API.
I whipped up a quick example:
codesandbox.io/s/suspicious-rosali...
It's full of flaws and not really visually pleasing but this is kind of what I meant.

Thread Thread
 
sapinder_dev profile image
Sapinder Singh

Check out how I implemented the share thing in my blog- blog.sapinder.dev