Click here to get back home

Disabling Anchor Href Tags

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Disabling Anchor Href Tags Nino 04-13-2007
Get Chitika Premium
Posted by Nino on April 13, 2007, 6:16 pm
Please log in for more thread options


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


Posted by Sherm Pendley on April 13, 2007, 6:42 pm
Please log in for more thread options



> 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

Posted by Adrienne Boswell on April 13, 2007, 9:09 pm
Please log in for more thread options



> -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
a.notloggedin:link

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


Similar ThreadsPosted
suppressing margins on
and tags
September 18, 2005, 5:08 pm
Anchor tags IE 7 February 25, 2007, 8:23 pm
CSS styles not working for anchor tags. August 13, 2005, 4:03 pm
[Q] Using the POST Method with HTML Anchor Tags March 23, 2005, 2:52 pm
Enabling and disabling JavaScript in IE 6 October 23, 2004, 3:25 pm
Style tags -- Eeek how obese these tags make HTML! November 8, 2006, 3:33 am
Meta Tags, Link Tags, other September 27, 2005, 3:29 pm
href+#+ie5 September 7, 2004, 4:18 pm
HREF within a FORM April 13, 2005, 9:36 am
HTML table and HREF April 5, 2006, 3:09 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap