This is a newbie question (I'm sure it is). I have tried for the first time in a little ASP.NET web application I am working on what happens if I disable Javascript in a browser (I'm testing mainly with Firefox).
Result: My application is pletely broken, although I didn't ever write any single line of Javascript.
For instance: I have a link button on a page from a LoginStatus control. Looking at the generated HTML code in my browser I see this:
<a id="ctl00_ctl00_LoginStatus" href="javascript:__doPostBack('ctl00$ctl00$LoginStatus$ctl02','')">Login</a>
Similar with some link buttons in a ListView control which allow to sort the list by certain data fields: The href
of the generated anchor tag contains this: javascript:WebForm_DoPostBackWithOptions(...)
.
So clicking on "Login" or trying to sort does not work without having Javascript enabled.
Does this mean: With disabled Javascript in the browser ASP.NET applications won't work properly? Or what do I have to do to get the application working with disabled Javascript?
Thanks for your feedback!
This is a newbie question (I'm sure it is). I have tried for the first time in a little ASP.NET web application I am working on what happens if I disable Javascript in a browser (I'm testing mainly with Firefox).
Result: My application is pletely broken, although I didn't ever write any single line of Javascript.
For instance: I have a link button on a page from a LoginStatus control. Looking at the generated HTML code in my browser I see this:
<a id="ctl00_ctl00_LoginStatus" href="javascript:__doPostBack('ctl00$ctl00$LoginStatus$ctl02','')">Login</a>
Similar with some link buttons in a ListView control which allow to sort the list by certain data fields: The href
of the generated anchor tag contains this: javascript:WebForm_DoPostBackWithOptions(...)
.
So clicking on "Login" or trying to sort does not work without having Javascript enabled.
Does this mean: With disabled Javascript in the browser ASP.NET applications won't work properly? Or what do I have to do to get the application working with disabled Javascript?
Thanks for your feedback!
Share Improve this question asked Feb 23, 2010 at 17:49 SlaumaSlauma 177k60 gold badges406 silver badges422 bronze badges 3- This is ASP.NET Web Forms, which is quite antique. This gives you absolutely no control over the rendered HTML and JavaScript. For full control of all HTML and JavaScript, you could use ASP.NET MVC instead. – bzlm Commented Feb 23, 2010 at 17:52
- 1 @bzlm "antique" in the "actively-maintained, with a major new version ing soon" sense? – bdukes Commented Feb 23, 2010 at 18:17
- @bdukes There was a COBOL demo, showing the new COBOL support (via 3rd party) in VS 2010 in the technical keynote on TechEd. Doesn't make COBOL less antique. :) graysmatter.codivation./post/… – bzlm Commented Feb 23, 2010 at 18:52
2 Answers
Reset to default 5Some stuff will work, some won't (see here). This is not to say you can't use ASP.NET without Javascript, you'll just have to avoid the below mentioned controls (and I'm sure a plethora of 3rd party controls as well).
The ASP.NET server controls that depend on being able to run client script include:
- The LinkButton and HtmlButton server controls require script. (This is not true for the Button Web server control or the HtmlInputButton or HtmlInputImage controls.)
- By default, the Calendar control implements month navigation and day selection using LinkButton controls. If you set control properties to allow users to select a day, week, or month, or if you allow users to navigate to other months, then the Calendar control will generate client script. If you use the Calendar control simply to display a single month with no selection or navigation, the control does not require client script.
- Any Web server control whose AutoPostBack property is set to true; the client script is required so that the control will post the page.
- The Web validation controls, which require client script to support client-side validation. If the client does not support script, validation will run on the server only.
Unless you switch over to the ASP.NET MVC framework, yes, ASP.NET sites built with the web forms model requires JavaScript.
Elements that have autopostback
turned on, any linkbutton
controls or button
controls, and any client-side validation will cease to function, as you've discovered.