Rich ajax applications that do not break if javascript is disabled.

All posts have moved to Typps

See you there.

Alessandro

9 Comments

  • Internet Explorer has supported disabling META REFRESH by domain since v6. The NoScript plugin for Firefox also provides an option to disable this tag. A better solution is to assume that script is disabled until you see the script-initiated request.

    In fact, with script disabled, the UpdatePanel works even when EnablePartialRendering is true. The only problem is the number of intrinsic ASP.NET controls which only work if script is enabled - e.g. the LinkButton control.

  • hi Richard, good catch. Indeed you are absolutely right. That really slipped my mind. I have updated the code. Thanks!

    As for controls that in turn render javascript internally like the LinkButton, they are lacking this type of functionality within.

    So a solution off the top of my head would be to inherit these controls individually and perform this test for js from within their render method, in case of the LinkButton for example, that could be made to render an html input button instead. It is however a lot of work, but doable ofcourse.

    A better approach again would be to try and make adapters for these controls, again that too has the work factor which is unavoidable. It's either that or wait for a future release of the .net framework that includes this type of rendering capability out of the box.

  • Is it possible to check javascript disabled on Java enabled web application?
    As currently i am working in a project where we are planning to use Ajax as client is expecting richer interaction.

  • Hi Om... it is possible in Firefox (I'm sure you can do it in other browsers)

    You just go to File > Preferences > Content and check the box that says Enable Javascript

  • I'm clearly missing something. When I run your code on my local machine or on the server, the behavior is as expected: the availability of JavaScript determines whether the page simply updates the inner time or reloads the whole page, thereby updating both times.

    But...

    (a) I don't see a querystring. Ever. Shouldn't that appear at least once?

    (b) I want to use this functionality to determine what to display on the page: an accordion control if JavaScript is enabled; flat text otherwise.

    Is this possible?

    Thanks

  • I am Sorry, the Above code is not working fine, if i disabled java script. one i disabled the java script and execute the same code in other window. then total page is posting to server. so, ajax is not working.

  • True, js is not essential but being able to degrade gracefully with minimum effort is equally important. noscript element won't get you very far on an ajax savy website. For instance take the updatepanel scenario that is able to degrade gracefully to full postbacks but needs to be enabled on the server. You end up not being able to reuse that feature with the noscript tag approach.

    Having alternative code for every instance of dynamic js code you have on a page will soon get overwhelming in terms of development time and maintainence.

    I prefer to tweak the current approach I've jotted here and fix the holes it has, as the one you pointed regarding people sharing the url. Unfortunately this is still an idea, and I've not had a chance to use in production code yet since disabling partial postbacks is only half the battle. You still need to fix instances of linkbuttons, dropdownlists with autopostback, textboxes with autopostback e.t.c

    Thanks for pointing out the deficiency. Very much appreciated.

  • First of all ... sorry about my poor English grammar! ... and thanks dear Alessandro to share your great idea...

    I think this is impossible to build RIA and Dynamic contents without JavaScript and Flash!
    I can't imagine Web 2.0 without Frameworks, Libraries, Accordions, Tabs, Sliders, Multiple-level menus, Lightbox's, Carousel's, Form validators, animation effects and so on...

    But "Disabled JavaScript" In Web 2.0 slowly turns to another black-hole for developers! (just like IE6 and Microsoft itself! -- sorry I hate monopoly)
    and what freaks me out is Microsoft disabled JavaScript in IE8 by default !!!!!?!!!!!

    I always worry about my clients JavaScript status! ... specially one with lack of amateur web experience!

    Final word ... W3School summery = 95% of users have JavaScript enabled in 2008 & 2009 ... So I use my favorite scripts and don't care about 5 percent!
    ----
    Ohhh, your commenting form not working at all without JavaScript!!! ... I have to enabled my JavaScript :)))))

  • Your english is excellent. Thanks for the comment :-)

Comments have been disabled for this content.