本文由 资源共享网 – ziyuan 发布,转载请注明出处,如有问题请联系我们!解密利用css的before和after属性防复制采集的方法和js代码
收藏下面的代码注入页面就可以复制采集了
<script type="text/javascript"> window.onload = function() { css=document.styleSheets[0].cssRules; ect.keys(css).forEach(function(k,v){ stylename=css[k].selectorText.split('::')[0]; content=css[k].style.content.replaceAll('"',''); document.querySelectorAll(stylename).forEach(function(ek,ev){ ek.replaceWith(content); }); }); }; </script>
油猴脚本(Tampermonkey)用下面的脚本
(function() { 'use strict'; var css=unsafeWindow.document.styleSheets[0].cssRules; Object.keys(css).forEach(function(k,v){ var stylename=css[k].selectorText.split('::')[0]; var content=css[k].style.content.replaceAll('"',''); unsafeWindow.document.querySelectorAll(stylename).forEach(function(ek,ev){ ek.replaceWith(content); }); }); })();