我正在一个处理用户数据的网站上工作,我想知道当用户单击浏览器中开发人员工具中的控制台选项卡时,如何警告用户。来自facebook的东西:
并且还将javascript错误隐藏在日志中。
先感谢您
最佳答案
尝试添加如下内容:
<script type="text/javascript">
const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
const warningDescCSS = 'font-size: 18px;';
console.log('%cStop!', warningTitleCSS);
console.log("%cThis is a browser feature intended for developers. If someone told you to copy and paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.", warningDescCSS);
console.log('%cSee https://www.facebook.com/selfxss for more information.', warningDescCSS);
</script>
https://gist.github.com/tosbourn/f556ee09c4a551e91d1dfde2f7b254f4