File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Clientside script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Clientside script" Watch "Clientside script" New topic

Clientside script

sundar sankaran

Joined: Aug 10, 2004
Posts: 10
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

Joined: Nov 08, 2001
Posts: 15385
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!

Neerav Narielwala
Ranch Hand

Joined: Dec 08, 2006
Posts: 106
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!):

<meta http-equiv="refresh" content="0;url=status.html">
The <noscript> tag, as per 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!

<a href="" target="_blank" rel="nofollow">Java Tutorials</a> | <a href="" target="_blank" rel="nofollow">Java Weblog</a> | <a href="" target="_blank" rel="nofollow">Computing Articles</a>
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
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!

I agree. Here's the link:
subject: Clientside script
It's not a secret anymore!