If Javascript is disabled...

He has: 698 posts

Joined: Jul 2005

This is more of a question out of curiosity on my end rather than a 'I have a code and want to know what to do with it' sort of query. I've been reading a book on JavaScript (really outdated but still very useful for a lot of the basic stuff that I can't seem to find a good resource for online), and I've been considering some ways I could update and streamline the website I'm working on using JavaScript. However, if someone who has JavaScript disabled (not sure how frequent this actually is) visits my website, should there be an alternative to the pages that use JavaScript?

Say on the registration page, I wanted to use JavaScript (actually more streamlined with AJAX concepts) to check if the username they have entered is available or not by clicking a button, should I have a separate registration page or method for checking the username for those who do not have JavaScript enabled?

Just wondering...

Kurtis

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

You should never limit your data validation to only client side. Use server-side validation, or both because anybody can modify those scripts and even make their own page to post potentially unwanted information to your website.

He has: 698 posts

Joined: Jul 2005

Allow me to clarify.

The JavaScript validator allows the potential member to check the username they have entered in the database. If it is available, they get a confirmation message; if not, an error message. This all happens within the page. Then, when they have finished the form, they click the submit button and the PHP tests are run to check the form data and check back with the databases to root out repeats or invalid data, and if there are any errors, they are returned to the visitor so they can fix the invalid forms. If it is all valid, they get another confirmation message...blah blah blah.

However, back to the username confirmation. If they have JavaScript disabled, this button will not work properly, and would probably be a bit frustrating to the visitor if they try to use it. For these people, shall I provide a JavaScript-free version of the site?

Kurtis

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

As a good web designer, it would be a good idea, but I wouldn't. Personally, I think that it's their choice that they don't want to use JS, and you don't have to make your site compatible with everything, otherwise all sites would be down to lynx functionality.

Busy's picture

He has: 6,151 posts

Joined: May 2001

turning javascript off does happen, I have done it when browser newbie type sites.

When I do anything with javascript I always make full use of the , even if just to say sorry you need javascript on for this

He has: 629 posts

Joined: May 2007

pr0gr4mm3r said:

Quote: Personally, I think that it's their choice that they don't want to use JS

FWIW - It's not always a "user choice." I understand that some multi-national corporations disable JavaScript on sites outside their Intranet. I also know some school districts that do the same.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.