18

最近有人告诉我,我的网站被复制了。当我查看他给我的链接时,除了徽标和文字外,该网站与我的网站相同。有没有办法隐藏我的代码?或者使无法右键单击我的页面?我在一些网站上看到,如果您访问http://example.com/images/,它将显示访问被拒绝,而不是包含所有图像的列表......他们是如何做到的?谢谢!

4

8 回答 8

14

您可以通过 obscurity来做相当于安全的事情,但防止您的客户端 Web 源可复制的唯一方法是不要将其推送到网络上,首先不要交付它,关闭您的网站。

于 2012-09-22T12:25:43.950 回答
9

不要这样做!这样做是没有意义的,因为用户可以禁用脚本,并且有许多工具,如 Firebug,用户可以通过它们查看代码。

保持商店安全的最佳方法是在开门的同时安装安全摄像头。

您可以通过以下操作简单地禁用右键单击:

<body oncontextmenu="return false">
  ...
</body>

或者

<script language="javascript">
  document.onmousedown = disableclick;
  status = "Right Click Disabled";
  Function disableclick(e)
  {
    if(event.button == 2)
    {
      alert(status);
      return false; 
    }
  }
</script> 

上面的代码来自这篇文章

于 2012-09-22T12:26:43.853 回答
8

No, there is no way to hide one's code on the web. If you're sending information to the client-side, that information can be copied. That's not merely a fact of the web, that's a fact of information theory. The only option for cases like this is not prevention, but detection. Many services exist to help in these situations.

Depending on your web host, preventing the listing of files in an images/ directory, for example, may be done by adding an .htaccess file with appropriate restrictions, or disabling directory listings from within your host's panel. The key words you need are "disabling directory listings". Talk to your webhost's support for more details, this is a very common request, so they likely already know exactly how to help you.

Note that this will only prevent the listing of images in a convenient form. If they are referenced on other pages on your site, they can still be easily downloaded.

于 2012-09-22T12:31:41.873 回答
2

隐藏右键单击处理程序只会阻止诚实的人获取页面源,而不是那些使用wgetcurl等工具的人。您可以混淆或缩小您的 JavaScript(例如使用Google Closure),但是,如果浏览器需要访问代码或内容,那么恶意的人也可以。

于 2012-09-22T12:26:17.460 回答
2

In that case, probably they have an access to your ftp account. If I were you I will change my ftp credentials.

And also, there are tools that would really copy all of the websites content, including its source codes. One notable is IDM or Internet Download Manager http://www.internetdownloadmanager.com/ which has a Site Grabber feature.

于 2012-09-22T12:29:16.650 回答
1

just create an empty index.html page and upload to your images folder, that solves it, so whenever they use /images..

于 2013-10-15T23:24:35.800 回答
1

There is no full proof way.

But here is some strategy that can be employed to hide source code like using "window.history.pushState()"

Detail here - http://freelancer.usercv.com/blog/28/hide-website-source-code-in-view-source-using-stupid-one-line-chinese-hack-code

于 2018-12-01T15:42:40.313 回答
0

imho, it is impossible. Even if you block right click, F12, Ctrl+C/V, or others shortcut to copy, you can still counter with disable JavaScript and copy the the page source.

于 2015-11-15T14:44:51.727 回答