Disabling Anchor Href Tags

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I have done some searching through groups and haven't found an answer
that suits my needs, so I hope to ask again. Is there a way to disable
an anchor tag within HTML?

Here's why:
I am trying to write a persmissions based system where an
administrator can log in and have a page customized to their rights. I
could very easily remove links all together, but I want them to know
that the system has that capability and they are just not allowed
access. I've written code in JSP to handle and store the rights in a
database and build the HTML page for display. However, I want to use
something simple like:

-A href="viewinfo.jsp"- View User Information -A-
-A href="editinfo.jsp" disabled- Edit User Information -A-

to just disable the ability to Edit information if they are not
granted access.

Does HTML have something that simple, or am I stuck using code and
javascript to solve my problem???

To simplify, why doesn't -A href- work like -Input type="checkbox"

Hope that made sense! Thanks in advance for any help.

Nino Skilj

Re: Disabling Anchor Href Tags

Quoted text here. Click to load it

JavaScript will absolutely *not* solve the problem. Trusting the client
to cooperate is not adequate security. It's not security at all.

You need to produce the "disabled" links on the server. If you want to
indicate to your users that they may be enabled under certain conditions,
produce links that point to a page or a JavaScript popup explaining why
the link isn't accessible to them.

In other words, since you can't disable links on the client, and since
it wouldn't be viable security to depend on clients obeying a hypothetical
"disabled" attribute even if such a thing existed, you'll have to "fake it"
by writing your server-side code to produce different targets for those

Quoted text here. Click to load it

If you want to know why the W3C and/or browser makers chose not to allow
that, you'll have to ask them. Speculating about it here is pointless.


Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net

Re: Disabling Anchor Href Tags

Quoted text here. Click to load it


<% if is loggedin then %>
    <a href="page.html">Page</a>
<% else %>
    <a href="<%=request.servervariables("script_name")%>#content"
title="You must login to access this link" class="notloggedin"
onclick="alert('You must be logged in');return false">Page</a>
<% end if %>

In your external stylesheet:

Adrienne Boswell at Home
Arbpen Web Site Design Services
Please respond to the group so others can share

Site Timeline