在查看页面源上的< a>标签中隐藏网址 [英] Hide Url from <a>tag on View Page Source

查看:274
本文介绍了在查看页面源上的< a>标签中隐藏网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站,在其中我有一个 href 标签,类似于

I am developing a website, where in i have a href tag somewhat like

<a href="Folder1/Sample.pdf" target="_blank">xam study papers</a>

这将在新标签中打开pdf.

which will open the pdf in a new tab.

现在,当我在google chrome和

Now when i open this website on google chrome and

右键单击->查看页面源代码"

Right Click->View Page Source

.我可以看到相同的内容.

. I can see the same Content .

我想隐藏href链接,所以我尝试使用Javacript

I want to hide the href link so i tried with javacript

<a href="#" id="id1" >xam study papers</a>
<script>
$( document ).ready(function() {
$("#id1").on("click", function () {             
   window.open('Folder1/Sample.pdf','_blank');
                });
 });
</script>

仍然显示.

所以我需要隐藏url.最好的方法是做同样的事情.任何帮助表示赞赏.

So i need to hide the url . What are the best possible methods to do the same. Any help appreciated.

推荐答案

您无法从源中隐藏标签,因为浏览器需要这些标签来填充网站.

You cannot hide the tags from the source, because the browser require the tags for populating the website.

  • 使用Javscript加密.
  • 禁用右键单击,如果可能的话.但是跨平台问题需要 注意,我更喜欢Javascript.
  • 了解HTML加密和javascript加密
  • 对此有一篇不错的文章:
  • Use Javscript encryption.
  • Disable Right Click , If possible. But Cross platform issues need to be taken care, i would prefer Javascript.
  • Learn on HTML encryption & javascript encryption
  • There is a nice article on this: How to hide your Source Code

如何加密HTML源代码?

这篇关于在查看页面源上的&lt; a&gt;标签中隐藏网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆