LinkButton and JavaScript accessability

  • Thread starter Thread starter Marc Wickens
  • Start date Start date
M

Marc Wickens

Hi

I have noticed that the LinkButton creates a hyperklink to a javascript
location .e.g.
<a href="javascript:__dopostback"

This is bad for accessability because browsers without Javascript won't be
able to follow the links.
Where possible I have used normal links that change the query string of the
page, however some things, such as submitting forms are impossible.

So, my question is - is there a way (I'm sure there is, just not sure how)
of changing LinkButtons to standard buttons if javascipt is disabled?
I know that ASP.NET does make changes based on whether or not the client has
JavaScript support.
Both the Button and LinkButton implement IButtonControl, which have the
click event and text property.
This would idealy be s site wide solution, and would allow me to use
LinkButtons (which look a lot nicer than buttons) for most users, but if the
client doesn't support Javascript then normal Buttons would be displayed.

Thanks to anyone who may be able to help,

Marc
 
I don't think you can detect on server side if javascript is disabled in
browser security settings. You can detect if the browsers supports
javascript or not (Request.Browser.JavaScript), but it is next to useless.

There are too many things in asp.net to worry about if you want to provide
for disabled javascript.

According to http://www.w3schools.com/browsers/browsers_stats.asp only 5% of
users have javascript disabled. And they are unlikely to use any serious
interactivity.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
Back
Top