ttxxyy112233
V2EX  ›  Android

安卓 WebView 中如何获取用户当前选中的字符串

  •  
  •   ttxxyy112233 · Mar 22, 2018 · 14134 views
    This topic created in 3166 days ago, the information mentioned may be changed or developed.

    用了 window.getSelection().toString()还是不行,不知道是什么情况

    3 replies  •  2018-03-23 10:22:47 +08:00
    crystom
    crystom
    Mar 22, 2018
    1
    浏览器不支持,很正常
    ttxxyy112233
    ttxxyy112233
    OP
    Mar 22, 2018 via Android
    2
    @crystom 原来是浏览器的问题吗 😂
    lukunlin
    lukunlin
    Mar 23, 2018
    3
    前端问题的话就没必要来 V2 了吧,百度不是一大堆吗~



    一般使用 input 的 DOM 对象去调用 select 方法后,使用 document.execCommand("Copy")就可以把选中的内容复制到剪贴板了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1920 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 08:34 · PVG 16:34 · LAX 00:34 · JFK 03:34
    ♥ Do have faith in what you're doing.