Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I temporarily disable javascript AFTER a page has loaded?

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 Javascript 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.

like image 706
Simon_Weaver Avatar asked Feb 01 '09 00:02

Simon_Weaver


3 Answers

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

like image 173
scunliffe Avatar answered Oct 03 '22 21:10

scunliffe


Test in FireFox with the NoScript addon.

like image 21
Nosredna Avatar answered Oct 03 '22 19:10

Nosredna


I've decided to write a separate answer on this question because I find this topic actually very important. And apparently my comment above hasn't been noticed.

In the past, functionality described: "disable javascript after browser has rendered the content", was easily accessible in Opera.

But independent Opera now is dead (now it's Chrome). And apparently there is almost no independent browser at all (google is the default search engine, and often you cannot replace it with your own search engine - duckduckgo would be probably much better alternative).

Well, one can consider that as just an opinion. But, well, It's pretty clear that dynamic-JS-toggle was removed from all major browser for a reason.

I've tried many popular browsers and there is no single one that provides such functionality.

Currently the only up-to-date solution is using surf browser and patch it a bit. Which is to change 1 into 0 in line:

setparameter(c, 1, (ParamName)a->i, &curconfig[a->i].val);

Surf (about, sources, patches): https://surf.suckless.org/

like image 21
sZpak Avatar answered Oct 03 '22 19:10

sZpak