从 Spotify 应用程序复制文本
我的应用程序从当前正在播放的歌曲生成一个链接。我的想法是设置一个带有单击事件的按钮,将链接复制到剪贴板。
我见过像 zeroclipboard 这样的解决方案,但不允许使用 Flash,所以它应该只是 javascript 。
My application generates a link from the song that is currently playing. My idea is to set a button with a click event that copy the link to the clipboard.
I've seen solutions like zeroclipboard but flash isn't allowed, so it should be just javascript.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,这只适用于 Flash。我认为最好的解决方法是将文本放入输入框中并指示用户手动复制它。
From what I can remember, this only works in Flash. I think the best workaround is to put the text in an input box and instruct the user to copy it manually.
是的...不要那样做。
训练您的用户使用拖放(这对于 HTML 链接来说效果很好,无需任何“聪明”的技巧)。他们会为此感谢你的。
如果您无法通过拖放实现所需的效果,请针对您尝试拖放的应用程序提交错误。
Yeah... Don't do that.
Train your users to use drag-and-drop (which works fine for HTML links without any "clever" hacks). They will thank you for it.
If you can't achieve what you want with drag-and-drop, submit a bug against the application you're trying to drag-and-drop into.
这是行不通的:
It's not going to work: