对用户隐藏 HTML 代码?

发布于 2024-11-06 05:46:10 字数 263 浏览 0 评论 0原文

我尝试隐藏几个元素,以便最终用户在看到页面源代码时看不到它。这似乎不可能,因为浏览器将下载并读取此代码。因此,用户会找到一种方式来阅读它。

然而,我发现有些网站隐藏了部分来源!看看这个网站:http://namechk.com/ 。与站点列表相关的源代码不存在!! 该代码是 HTML 代码吗?还是有其他可以隐藏的东西? 有人知道一种方法吗?

谢谢

I tried to hide a couple of element so that the end users can NOT see it when they see the page source. It seems NOT possible because this code will be downloaded and read by the browser. So, the user will find a way to read it.

However, I found some websites that hide part of the source! Take a look at this website: http://namechk.com/ . The source code related to the sites list is NOT there!! Is the code an HTML code? or it is something else that can be hided?
And any one know a way to do this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

心碎的声音 2024-11-13 05:46:10

这是因为该页面严重依赖 javascript。但您也可以(并且您的浏览器也可以)下载 JavaScript。如果您深入研究它们,您会发现页面是如何生成的。

你可以混淆你的 JavaScript,但我认为这没有什么意义。您是否认为您的 HTML 如此独特以至于有人会窃取它?

It is because the page heavily relies on javascript. But you can (and your browser does) download the javascripts as well. If you dig into them you will find out how the page is generated.

You can obfuscate your javascript but I don't see much point in that. Do you think your HTML is so unique that somebody would steal it?

两相知 2024-11-13 05:46:10

不可能对浏览器隐藏 html 代码。即使在您发布的链接中,html 代码也在那里。它只是动态加载的。看一下 Firebug 中的 DOM。

It is impossible to hide html code from the browser. Even in the link you posted the html code is there. It's just loaded dynamically. Have a look at the DOM in Firebug.

顾铮苏瑾 2024-11-13 05:46:10

该网站没有显示详细信息,因为它使用 Asp.net、JavaScript 和 jQuery 来显示数据。

您可以在这里查看:http://w3techs.com/sites/info/namechk.com

不可能对客户端隐藏 html。

您可以做的一件事是使用 JavasSript 或 jQuery 删除不必要的元素。

The site is not showing the details because it is using Asp.net, JavaScript and jQuery to display data.

You can check it here: http://w3techs.com/sites/info/namechk.com

It is not possible to hide html from the client.

One thing you can do is remove unnecessary elements using JavasSript or jQuery.

绿萝 2024-11-13 05:46:10

HTML 可以隐藏在 iFrame 中,从另一个页面提取源代码(尽管他们可以从那里查看源代码)

HTML can be hidden in an iFrame, pulling the source from another page (though they could view the source from there)

你与清晨阳光 2024-11-13 05:46:10

您可以通过 ajax 调用将要隐藏的代码加载到 div 中。该 div 的内容不会在浏览器源中看到。

<script>
//ajax call via jQuery/Prototype loading content into div below
    $.ajax({
        url: "somepage.php",
        data: 'yourParameters'
        },
        success: function(data){
            $('#loadhtmlinviaAjax').show(); //toggle display status of this div as required
            $('#loadhtmlinviaAjax').html(data);
        }
    });
</script>

<div id="loadhtmlinviaAjax" style="display: none;"></div>

You could load code you want to be hidden into a div via an ajax call. The content of this div won't be seen in the browser source.

<script>
//ajax call via jQuery/Prototype loading content into div below
    $.ajax({
        url: "somepage.php",
        data: 'yourParameters'
        },
        success: function(data){
            $('#loadhtmlinviaAjax').show(); //toggle display status of this div as required
            $('#loadhtmlinviaAjax').html(data);
        }
    });
</script>

<div id="loadhtmlinviaAjax" style="display: none;"></div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文