Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clientside script

 
sundar sankaran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javascript code will be executed on clientside. What happen when user disable the javascript? Whether all the browser will run the Ajax code???
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets see...Ajax = JavaScript

JavaScript Disabled = JavaScript does not run

SO since Ajax = JavaScript that means you already answered your question.

I think there is a better quesiton in this saying: If the user disables JavaScript, what steps can I take as a developer to make sure that these users are not let out in the cold?

Now that is a better question!

Eric
 
Neerav Narielwala
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The solution: <noscript> and <meta> tags.

I place the following in the HTML Head Content (inside the <head> tag for you web-heads out there that, like me, hand-write your own DHTML!):

<noscript>
<meta http-equiv="refresh" content="0;url=status.html">
</noscript>
The <noscript> tag, as per W3Schools.com is described below:

"The noscript element is used to define an alternate content (text) if a script is NOT executed.

This tag is used for browsers that recognizes the <script> tag, but does not support the script in it."
So what we're doing here is redirecting the user agent based on their ability to recognize the <script> tag, but failure to do anything about it (due to, for example, the user agents lack of functionality which you'll find in some WAP/Mobile browsers, or a very capable user agent with Javascript disabled).

As for the destination (read: now that I know you can't use my beautiful UI, where do I send you?!), this is where Google and I part company. Google Maps simply redirects to a page that tells the user that their browser is not currently supported - which IMHO will only confuse the user, as if they only disabled Javascript on their browser, they're likely to find their browser amongst the "Support Browsers" listing. No, I recommend a modification of another method I talked about a while back: An Attempt at Dynamic Content via Javascript

Using this method, you can have your application redirect to status.html with various "status codes", yielding various dynamic/context-sensitive messages to the user agent. Of course, this heavily utilizes Javascript, but you can display the following as the default content in your status.html:

If Javascript is disabled or otherwise not available, the innerHTML of the content container is not changed, and therefore this message is displayed to the user and becomes a reliable redirect/status/landing area for your web-based applications!
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what if Meta Refresh is disabled.

If you want to see something interesting. Goto Google's Gmail with JavaScript disabled. That is all Ajax based and it works!

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic