Comments (17)
😧
from clipboard.js.
Not supported :(
I would really like to see it in mobile because a lot of other options don't do it.
from clipboard.js.
For clarity, when I tested on both Safari and Chrome mobile browsers on iOS when, when I click a copy button on the demo site, I just see the 'Not Supported' popup. The browser focuses the input field, but the text is not selected. Even if we can't copy directly to clipboard on mobile, are there browser APIs available to at least automatically select the text waiting to be copied?
from clipboard.js.
@chrismanderson I did the exact same thing and got the exact same results.
from clipboard.js.
As described in the Browser Support section, execCommand is not supported on mobile yet. So for now, there's nothing we can do about it.
Regarding text selection on mobile, there's seems to be a workaround using setSelectionRange
http://stackoverflow.com/questions/3272089/programmatically-selecting-text-in-an-input-field-on-ios-devices-mobile-safari
Pull requests are welcome.
from clipboard.js.
@zenorocha: I'm interested in fixing this bug, may you please clarify what exactly should be done?
Are we going to select the input text only if we're on mobile and copy is not supported?
from clipboard.js.
What should be done is simply selecting text on mobile devices.
from clipboard.js.
I do this (copies on desktop and Android, and selects on iOS): https://jsfiddle.net/ryanpcmcquen/dx5vvzc1/
from clipboard.js.
Hey @ryanpcmcquen, I tested on an iPhone & iPad but selection didn't work.
from clipboard.js.
@zenorocha are you on iOS 9? Try the full screen version (https://jsfiddle.net/ryanpcmcquen/dx5vvzc1/embedded/result/). Works here for me.
from clipboard.js.
Confirmed that it does work on the iOS simulator but not on real devices.
from clipboard.js.
I just tested this on my iphone and my ipad and it worked for me! (Tested it in Safari)
from clipboard.js.
@zenorocha @ryanpcmcquen See comment above.
from clipboard.js.
Since it does seem to work on some iOS devices, I implemented a library for it:
https://github.com/ryanpcmcquen/simpleJsCopy
Not as robust as clipboard.js, but it may suit some people's needs. 👍
from clipboard.js.
Hey @ryanpcmcquen,
I see you discovered how make a selection on iOS devices. Could you make a PR?
from clipboard.js.
@zenorocha, I see you could not be bothered to star my repo while asking for code from it ... 😕
from clipboard.js.
Hey everyone, I just moved all selection logics from clipboard.js to a different repo called select c6dc01c.
Also moving this issue there zenorocha/select#1
from clipboard.js.
Related Issues (20)
- Transition from document.execCommand to navigator.clipboard
- Copy/Paste does not work with ' character HOT 2
- How we can force/test error event? HOT 3
- Add New Line to Clipboard HOT 6
- Docs to explain copy all code blocks on a page at once. HOT 2
- Html attribute conflict HOT 1
- Need event.stopImmediatePropagation() to prevent the event from triggering a redirect HOT 1
- clipboardjs not working modaal js HOT 2
- Doesn't work properly in Safari 16.5.1 HOT 4
- how about dbclick action ,and then twice copy result
- Enhance the container option HOT 5
- if 2 #copy elements then some bugs HOT 4
- window.execCommand execute failed but success event be triggered!!
- innerText or Similar Removes Double Spaces
- It won't work on iOS16 or above,15 and the following systems are normal HOT 1
- Demo page uses old script with focus loss bug
- Page hangs after copy the text
- Client potential XSS - feedback needed
- Avoid serving legacy JavaScript to modern browsers @babel/plugin-transform-classes HOT 1
- Regression in 2.0.9 leading to values other than type string (number, boolean) cannot be copied
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipboard.js.