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

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

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

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

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

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

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