paste.js icon indicating copy to clipboard operation
paste.js copied to clipboard

How to detect whether browser supports pasting?

Open jmuheim opened this issue 9 years ago • 8 comments

Hey there

Thanks a lot for this amazing little helper, we use it in our web app extensively.

We have an image upload field, which is simply a textarea now, and using paste.js, a pasted image is converted to base64, and the base64 string is sent to the app and there saved as a normal PNG file.

At the moment, we rely on users having a supporting browser (IE11, FF, Chrome). But we'd like to add a switch that displays a normal upload field, when the browser doesn't support pasting.

Is there an easy way to detect this? You have this matrix in the README; it would be great to have a little JavaScript helper method returning true/false depending on support status.

Best wishes.

jmuheim avatar Feb 16 '17 08:02 jmuheim

Hi @jmuheim , there's no way to detect the support straight forward. But I can definitely put an API to indicate the support, after I can do some testing through BrowserStack, specifically around mobile browsers. 👍 I'll pop you when it's there.

layerssss avatar Feb 16 '17 23:02 layerssss

I mentioned mobile browsers because on some browsers / versions although there is API support, but no interaction for "paste" (i.e, press Ctrl + V)

layerssss avatar Feb 16 '17 23:02 layerssss

Great, thank you! :-)

On 17 Feb 2017, at 00:27, Michael Yin <[email protected] mailto:[email protected]> wrote:

I mentioned mobile browsers because on some browsers / versions although there is API support, but no interaction for "paste" (i.e, press Ctrl + V)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/layerssss/paste.js/issues/36#issuecomment-280497983, or mute the thread https://github.com/notifications/unsubscribe-auth/ABuxxxgOTM9FuCbI-csV07l-nl3pEN96ks5rdNtlgaJpZM4MCuqR.

https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png https://github.com/layerssss/paste.js https://github.com/layerssss/paste.js/issues/36#issuecomment-280497983

jmuheim avatar Feb 17 '17 10:02 jmuheim

Any news on this?

jmuheim avatar May 12 '17 13:05 jmuheim

@jmuheim I've found myself hard to allocate time for this. Do you have a schedule for implementing related feature in Reviewable? (I'll try to implement the API before that)

FYI: it's now working in Safari 🎉

https://github.com/layerssss/paste.js/issues/42

layerssss avatar May 13 '17 06:05 layerssss

What's "Reviewable"?

No I don't have a schedule. Take yourself time, it's good to hear that you're planning to add it.

jmuheim avatar May 15 '17 10:05 jmuheim

Haha, my bad, forget my question. Yeah, I'll push it recently!

layerssss avatar May 15 '17 10:05 layerssss