隐藏状态栏的web地址

原创 2004年08月20日 11:45:00

Introduction

When you move your mouse pointer on any of the link in the browser, the corresponding hyperlink is shown in the status bar. As a webmaster or developer of a web site, many times you want to hide such hyperlinks in your pages. This is needed frequently in download pages to hide the original content location or payment related pages. In this small code sample we will use ASP.NET HyperLink web control to display our links and then write code to hide them from the site visitors.

The code

As an example let us assume that you have a HyperLink control called HyperLink1 on the web form. When that control is rendered in the browser; it gets converted into an HTML <A> tag. In order to hide the URL from the end user we need to handle three of its client side events:

  • OnMouseOver
  • OnMouseMove
  • OnContextMenu

You might be wondering why we need to handle the third event. This is event is raised when user right clicks on the link. Since we want to hide the link; we also would not like the visitors to use "Copy Shortcut" option from the right click menu. Hence, we also need to handle the OnContextMenu event.

Note that these are client side events and we need to write JavaScript code to handle them. There are two steps involved in this:

  • Attach client side events and their event handler function in your server side code.
  • Write client side function to handle the events

Attaching events and event handler

In order to attach a client side event and its handler ASP.NET provides an Attributes collection. You can use this collection as follows:

HyperLink1.Attributes.Add("onmouseover","HideLink();"); 
HyperLink1.Attributes.Add("onmousemove","HideLink();");
HyperLink1.Attributes.Add("oncontextmenu","return false;");

Here, we are specifying that OnMouseOver client side event will be handled by a function called HideLink(). In the OnContextMenu event we simply want to return false to indicate as if that event never fired.

Client side function

Here is the JavaScript function that does the job for us.

function HideLink() 
{
window.status="You do not see the link here!";
}

Here, we simply set the status bar text of the browser window to some custom text. That's it.

Download

You can download the complete sample code of this article. Just click on the download link at the top of this article.

Summary

In this small article we saw how one can hide hyperlinks in the client browser using ASP.NET controls and JavaScript.

移动端webapp如何隐藏地址栏

1、很多资料说,添加以下代码,可以隐藏地址栏,但我试了很多次,貌似不成功啊。 meta name="apple-mobile-web-app-capable" content="yes" /> ...
  • kongjiea
  • kongjiea
  • 2014年09月19日 16:26
  • 9106

Android动态显示和隐藏状态栏

简述: View类提供了setSystemUiVisibility和getSystemUiVisibility方法,这两个方法实现对状态栏的动态显示或隐藏的操作,以及获取状态栏当前可见性。 setSy...
  • zl18603543572
  • zl18603543572
  • 2015年11月14日 02:00
  • 14223

Android中状态栏的隐藏

网上找了好多状态栏隐藏的方法,搜集总结一下,供以后参考。  转载请注明出处:http://blog.csdn.net/harhy 系统中状态栏的隐藏 定制系统的时候,想去掉系统中的状态栏,系...
  • harhy
  • harhy
  • 2013年01月22日 11:04
  • 19464

Urlrewritefilter(Java Web 地址隐藏)

一、Urlrewritefilter说明及优势        Urlrewritefilter,通过java的Filter过滤器对URL进行重写,用户得到的全部都是经过处理后的URL地址,本质上...
  • QQ86557856
  • QQ86557856
  • 2015年06月27日 16:41
  • 524

WinCE/Mobile 隐藏状态栏 C#

  • 2014年05月08日 10:58
  • 60KB
  • 下载

状态栏图标的隐藏

  • 2006年02月23日 09:05
  • 155KB
  • 下载

状态栏图标隐藏工具

  • 2013年12月04日 02:07
  • 1.7MB
  • 下载

Android双击屏幕动态实现全屏(隐藏标题栏状态栏)

  • 2017年08月31日 16:20
  • 2.12MB
  • 下载

豆瓣电台 可以隐藏到状态栏

  • 2011年09月22日 17:55
  • 11KB
  • 下载

显示和隐藏状态栏的资源

  • 2010年06月30日 17:13
  • 77KB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:隐藏状态栏的web地址
举报原因:
原因补充:

(最多只允许输入30个字)