By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

Disabling Anchor Href Tags

P: n/a
Hello,

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"
disabled-???

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

Nino Skilj

Apr 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Nino" <ni********@yahoo.comwrites:
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???
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
links.
To simplify, why doesn't -A href- work like -Input type="checkbox"
disabled-???
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.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Apr 13 '07 #2

P: n/a
Gazing into my crystal ball I observed "Nino" <ni********@yahoo.com>
writing in news:11**********************@o5g2000hsb.googlegro ups.com:
-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???
In ASP

<% 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:
a:link {color:blue}
a.notloggedin:link {color:green;cursor:help}

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Apr 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.