网页复制内容追加到剪切板

2021-08-08 06:57

阅读:785

标签:rdd   ext   sel   set   int   rgba   turn   app   span    function addLink() { let body_element = document.body; let selection = window.getSelection(); let locationHref = document.location.href; let appendLink = "\r\n\r\n 原文出自[ ushowtime ] 转载请保留原文链接: " + locationHref + ""; if (window.clipboardData) { // Internet Explorer let copytext = selection + appendLink; window.clipboardData.setData("Text", copytext); return false; } else { let copytext = selection + appendLink; let newdiv = document.createElement(‘div‘); newdiv.style.position = ‘absolute‘; newdiv.style.left = ‘-99999px‘; body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); }, 0); } }  网页复制内容追加到剪切板标签:rdd   ext   sel   set   int   rgba   turn   app   span   原文地址:https://www.cnblogs.com/ushowtime/p/14878127.html

上一篇:HTML(1)

下一篇:C# 正在表达式 -- 复习


评论


亲,登录后才可以留言!