从 Spotify 应用程序复制文本

发布于 2024-12-28 13:20:14 字数 197 浏览 3 评论 0原文

我的应用程序从当前正在播放的歌曲生成一个链接。我的想法是设置一个带有单击事件的按钮,将链接复制到剪贴板。

我见过像 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

给我一枪 2025-01-04 13:20:14

据我所知,这只适用于 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.

你是年少的欢喜 2025-01-04 13:20:14

是的...不要那样做。

训练您的用户使用拖放(这对于 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.

画尸师 2025-01-04 13:20:14

这是行不通的:

>> document.queryCommandEnabled('Copy')
false

It's not going to work:

>> document.queryCommandEnabled('Copy')
false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文