写一段 JS,ios 用户打开网站后,自动复制一串指定的字符串到剪切板,
1
mbyzhang 2018-10-08 14:22:11 +08:00
```[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-08 14:24:10 +08:00
|
3
murmur 2018-10-08 14:24:47 +08:00
楼主是做自动领支付宝几分钱的黑产的吧
|
5
mbyzhang 2018-10-08 14:28:10 +08:00
@jxzzwlaq Telegram: https://t.me/pzhang_relay
|
7
o0 2018-10-08 15:14:12 +08:00
前几天搞了一段代码做了几天,环境跟几个月前完全不同,不好做了。
|
11
jxzzwlaq OP |