【问题标题】:How to not show code source from ctrl + u如何不显示来自 ctrl + u 的代码源
【发布时间】:2020-07-07 19:22:05
【问题描述】:

所以我在网上冲浪,发现了很酷的网站。当我想克隆他的设计时,我无法通过 (ctrl+u) 看到源代码。它没有显示。我怎样才能让它像他们一样。

网站-> sources

看起来我无法点击链接.. 这是原始的view-source:https://www.dte.web.id/

【问题讨论】:

  • 被 6 人查看但没有答案??
  • C O M M U N I T Y
  • 您可以通过开发者工具查看它是如何构建的。

标签: html css xhtml blogger


【解决方案1】:

使用下面的代码,您将禁用该功能 (ctrl + u)。重要的是要知道它不会阻止任何用户通过“查看源代码:链接”查看源代码

<script type="text/javaScript">
function testKeyCode(e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
var e = e || window.event;
           if (e.ctrlKey &&
                  (e.keyCode === 67 ||
                   e.keyCode === 86 ||
                   e.keyCode === 85 ||
                   e.keyCode === 117)) {
    alert('This website is protected against attempts to clone. Your IP has been duly recorded on our server and if you persist it will be forwarded to the competent authorities');
   return false;
   } else {
    return true;
   }
}
document.onkeydown = testKeyCode;
</script>

【讨论】:

  • 由于您的代码是客户端,因此您无法隐藏任何内容。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-26
  • 2015-10-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多