Home » Common, featured, JavaScript, Open Source

How to run Ajax app JavaScript Disabled browser?

9 April 2010 3 Comments

The following code demonstrates how the codes will look like. For example in navigation link the following code pattern will be used. If the JavaScript enabled it returns false to the caller which stops (it prevents the click) the usual html hyperlink navigation. If JavaScript is disabled then JavaScript function will not work and therefore by default it’s true and the normal hyperlink navigation will be executed.

Example code :

//JavaScript Function

Document.getElementById(“linklist”).onclick=getList;

function getList()

{

// The Ajax Call for the function in getlist.php file

...........

...........

...........

return false;

}

//Html

<a href=”getlist.php” id=”linklist” />

When the hyper link clicked, first the onclick event will be executed. If JavaScript disabled then it runs the default value as true and because of that the click event accepted and the normal hyperlink navigation will work. Because link navigations work when the mouse release occurs. If JavaScript enabled then the javascript function will be called and executed. At the last line it returns false, therefore the click event was cancelled. Since no click events, there are no release event as well. So normal navigation will not occur.

Facebook comments:

Powered by Facebook Comments

3 Comments »

  • izonedevelopers.com » Blog Archive » Turbo pma (Enhanced PhpMyAdmin) said:

    [...] Example shown in this link about the how the codes will look [...]

  • Wordpress Themes said:

    Amiable dispatch and this fill someone in on helped me alot in my college assignement. Gratefulness you on your information.

  • R1 woman said:

    Great detailed information, I just saved you on my google reader.

    Sent via Blackberry

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.