DEV Community

Cover image for Hands on Web Share API

Hands on Web Share API

Felix Jordan on August 19, 2021

Hello world, welcome to my first post! In this one, I will explain what the Web Share API is and what you can do with it. If you didn't work it yet...
Collapse
 
mojitane profile image
moji ///

Do you know any best practices for length of shared text or the size of shared images – or if they are different for different devices? Maybe I can find a preview generator for this to test.

Collapse
 
fezi32 profile image
Felix Jordan • Edited

Hey again, what also comes in my mind (regarding the question of a preview generator) is that you couldn‘t have any global preview generator, that works for every share taget. What you could do is a preview generator for one or multiple share targets, but a global preview generator is not possible. Because every share target (application) behaves different.

Collapse
 
fezi32 profile image
Felix Jordan

Good question! I couldn't find any limitations rather for length of shared text or size of shared images. But I think there are no real limitations out there. Maybe the share targets have the possibility to reject large files or long texts. This would mean that they will not show up in the dialog (maybe testing twitter with a long text would be interesting). But I think that there are no limitations.
But there could be the case, that maybe the share target will do something special with the text (truncating or whatever) or reduce the file size by reduce the quality.

I don't think that it is possible to find a preview generator. Anyways it couldn't be 100% correct, because the user agent/device has the power. But if you find one, let me know (I would be interested as well) :)

Collapse
 
maxprogramming profile image
Max Programming

This was super useful!

Collapse
 
fezi32 profile image
Felix Jordan

Thanks ☺️

Collapse
 
creativemacmac profile image
creativemacmac

Super useful❤️

Collapse
 
fezi32 profile image
Felix Jordan

Thank you 😊

Collapse
 
ryanguitar profile image
Ryan Els

Excellent. Works well. Thanks for sharing.

Collapse
 
fezi32 profile image
Felix Jordan

Thanks Ryan :)

Collapse
 
mrdulin profile image
official_dulin

Good to know this API, but the browser compatibility is not good now.

Collapse
 
fezi32 profile image
Felix Jordan

Yes, it‘s not good now. This is right. But of course you can use this feature anyway, because you can use it as progressive feature. That means, you use that feature on all browsers that are supporting this feature. All other browsers should then use a workaround :)

Then you are ready for the present and future as well :)

Some comments have been hidden by the post's author - find out more