• 请不要在回答技术问题时复制粘贴 AI 生成的内容
yantianqi
V2EX  ›  程序员

js 能不能实现点击复制内容到剪切板

  •  
  •   yantianqi · Oct 20, 2016 · 5084 views
    This topic created in 3671 days ago, the information mentioned may be changed or developed.

    js 能不能实现点击事件,复制内容到剪切板。在手机端,用 js 来实现或者 jq

    15 replies  •  2016-10-21 22:26:21 +08:00
    geeglo
    geeglo
    Oct 20, 2016
    1
    不能
    morethansean
    morethansean
    Oct 20, 2016
    4
    可以实现。
    drivedreams
    drivedreams
    Oct 20, 2016
    5
    必须可以
    wangkai123
    wangkai123
    Oct 20, 2016
    9
    safari 好像不可以
    searene
    searene
    Oct 20, 2016❤️1
    10
    billlee
    billlee
    Oct 20, 2016
    11
    你用过 github 吗?
    4641585
    4641585
    Oct 20, 2016❤️1
    12
    https://developer.mozilla.org/zh-CN/docs/Web/API/Document/execCommand

    copy
    拷贝当前选中内容到剪贴板。启用这个功能的条件因浏览器不同而不同,而且不同时期,其启用条件也不尽相同。使用之前请检查浏览器兼容表,以确定是否可用。

    @wangkai123 我现在用 10.0 版本的 safari 可以使用,看兼容列表像是这个版本提供的支持。
    hasbug
    hasbug
    Oct 20, 2016
    13
    有插件,配合 swf
    qweweretrt515
    qweweretrt515
    Oct 21, 2016
    14
    3 楼 +1
    mingyun
    mingyun
    Oct 21, 2016
    15
    @7sDream 赞一个
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   505 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 20:45 · PVG 04:45 · LAX 12:45 · JFK 15:45
    ♥ Do have faith in what you're doing.