views:

716

answers:

3

I want to disable Javascript once a page has already loaded.

Why?

Because I want to test how the behavior of something like the following 'degrades' when javascript isn't available, but i dont want the hastle of going to the browser's top level javscript enable/disable feature. In addition I specifically want to disable it after the page has loaded because I want to isolate my testing to how that one form would perform (I have jQuery running for the rest of the page and I don't want to lose that).

Allowing me to disable JS for this code allows me to test the form postback as well as the AJAX postback.

<form action="/pseudovirtualdirectoryfortesting/company/Contact" id="fooForm" method="post" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'submitting', onBegin: Function.createDelegate(this, submitComments_begin), onComplete: Function.createDelegate(this, submitComments_complete), onFailure: Function.createDelegate(this, submitComments_failure), onSuccess: Function.createDelegate(this, submitComments_success) });">

What plug-ins or tactics could I use. I want to be able to test in different browsers, and some projects I work on are designed only for one browser (not my fault) so I need as many possible solutions as there are.

+2  A: 

Test in FireFox with the NoScript addon.

Nosredna
+4  A: 

Get the Web Developer Toolbar for Firefox. With it you can disable Javascript at any time, disable cookies, css, whatever you want.

scunliffe
A: 

This is not answer to the generic question "how to disable javascript", but was a good solution for me.

I have stopped using Microsoft's AJAX in place of jQuery.

As a result of this I am using unobtrusive javascript and it is therefore much easier to disable just the AJAX handler for my form than it is with Microsoft Ajax.

All i do is comment out the line that hooks up the AJAX call to my submit button.

Simon_Weaver