【发布时间】:2012-11-15 15:17:51
【问题描述】:
javascript 函数必须搜索网页(html 正文)中的特殊链接(版权网址)。
如果它没有找到特殊的url,则必须发出警报。
JavaScript 文件示例:
if () {
//If function find the copyright links, then null - don't make anything
}
else
//If function doesn't find copyright links, then give an alert
alert("Please protect original copyright links.")
html页面示例:
<html>
<head>
<script type='text/javascript' src='http:// ... file.js'></script>
</head>
<body>
<!-- Start Copyrigt Area -->
<div id="footer">
<a href="http://example1.com">example1.com</a>
<a href="http://example2.com">example2.com</a>
</div>
<!-- End Copyrigt Area -->
</body>
</html>
为什么?
我为特殊的博客社区网站制作了一些主题。有时,我们的 主题用户删除或更改页脚区域中的版权链接。
博客社区网站不支持任何动态内容,如php, 我们只能在一个页面中使用 html 和一些特殊的内容标签。
另一方面,这个网站不允许JS托管等。所以,JS 第三方托管服务提供商提供的文件。
我不想加密代码。所以我认为我们检查链接 JavaScript 函数。如果我们的链接被删除或更改,那么用户必须 收到警报。
也许,一些主题用户发现这些 javascript 功能并删除 他们并重新托管代码。但我想他们中的大多数人不会 任何东西。
【问题讨论】:
-
搜索 DOM 不会阻止他们将 CSS 编辑为
display:none; -
静默点击某个 URL,以便您可以联系这些人。删除警报对他们来说是微不足道的,但许多人可能不会关注网络请求。
-
if (document.getElementById('footer') === null) { alert('this "protection" is futile'); } -
如果他们可以删除页脚,他们也可以删除您的 Javascript 代码。
-
这与想要禁用源查看、右键单击等的人没有什么不同。总会有办法绕过它。不要浪费你的时间。
标签: javascript html web