写一段 JS,ios 用户打开网站后,自动复制一串指定的字符串到剪切板,
1
mbyzhang 2018 年 10 月 8 日
```[js]
window.Clipboard = (function(window, document, navigator) { var textArea, copy; function isOS() { return navigator.userAgent.match(/ipad|iphone/i); } function createTextArea(text) { textArea = document.createElement('textArea'); textArea.value = text; document.body.appendChild(textArea); } function selectText() { var range, selection; if (isOS()) { range = document.createRange(); range.selectNodeContents(textArea); selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); textArea.setSelectionRange(0, 999999); } else { textArea.select(); } } function copyToClipboard() { document.execCommand('copy'); document.body.removeChild(textArea); } copy = function(text) { createTextArea(text); selectText(); copyToClipboard(); }; return { copy: copy }; })(window, document, navigator); Clipboard.copy('text to be copied'); ``` |
2
mbyzhang 2018 年 10 月 8 日
|
3
murmur 2018 年 10 月 8 日
楼主是做自动领支付宝几分钱的黑产的吧
|
5
mbyzhang 2018 年 10 月 8 日
@jxzzwlaq Telegram: https://t.me/pzhang_relay
|
7
o0 2018 年 10 月 8 日
前几天搞了一段代码做了几天,环境跟几个月前完全不同,不好做了。
|
11
jxzzwlaq OP |