开发者

Is it possible to develop completely 'javascript-free' website or web-application?

开发者 https://www.devze.com 2022-12-10 02:31 出处:网络
I\'m an ASP.NET developer having started long back in classic ASP. In Classis ASP everything had to be done manually, no smart-debugging support and not so great IDEs like VS [except DreamWeaver].

I'm an ASP.NET developer having started long back in classic ASP. In Classis ASP everything had to be done manually, no smart-debugging support and not so great IDEs like VS [except DreamWeaver].

Just a 'subjective' thought as it came in I wish to discuss it here as 'community-wiki'. Is It possible to develop completely 'javascript-free' website in any platform that is as usable and as secure as any website developed using today's smart web frameworks ? ASP.Net uses javascript for many purpose including the postback as primary feature using javascript.

What will be the developm开发者_JS百科ent approach to do this and what difficulties will we have to face doing so?

Can I have your views and ideas about this assuming the fact that HTTP is stateless ? and also that javascript makes no sense to server.


Not only is it possible to make sites that don't rely on JavaScript, but it is largely irresponsible to make your customers have it enabled/available for the site to function properly.

JavaScript should be used to enhance the experience and not be relied on for basic function.

Obviously, some sites cater to different audiences, but in general, any large commercial website is expected to work with or without javascript (though there are exceptions).

Specifically regarding ASP.Net, you have some options but it means not relying on certain controls.

See http://discuss.joelonsoftware.com/default.asp?dotnet.12.157029.2 for a similar problem

To quote:

AFAIK, Javascript is only necessary for

1) Client-side validators
2) Autopostback on non-button controls
3) The other controls mentioned in the MSDN article (posted on the Google thingum) - LinkButton, HtmlButton and Calendar

So, to avoid USING Javascript, you would have use ordinary form buttons instead of link buttons, use form buttons in conjuction with controls where you would otherwise use AutoPostBack, and use a free-form textbox and System.DateTime.Parse for dates.

To avoid SENDING Javascript, I don't know what the best solution is. One way would be to use the "downlevel" user agent setting on each page; this will probably prevent ASP.NET from rendering any CSS on server controls, but you can probably force that using the Attributes collection (control.Attributes["class"] = "CssClassName";)

Hope that helps a little.
Jesse Millikan
Thursday, July 07, 2005

EDIT

Also see: http://msdn.microsoft.com/en-us/library/3hc29e2a%28VS.71%29.aspx which provides information on which controls require javascript, and http://msdn.microsoft.com/en-us/library/aa983760%28VS.71%29.aspx which provides info on browser capabilities

To quote:

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.

And

The value of the ClientTarget property is an alias for the type of browser you want to render for. By default, the following aliases are available:

  • ie4 Renders with Internet Explorer 4 capabilities.
  • ie5 Renders with Internet Explorer 5 capabilities.
  • uplevel Renders with Internet Explorer 4 capabilities.
  • downlevel Renders with HTML 3.2 capabilities; that is, no CSS support.

EDIT

Regarding the second part of the OP question, JavaScript is strictly client-side in working with ASP.Net, however the code produced by ASP.Net will include JavaScript sent to the client for some common controls.

HTTP is stateless, yes, but cookies and sessions can be used to to store data to maintain state, of a sort. (cookies are usually also used for storing session ids for the resumption of sessions -- though you can support cookie-less sessions with the session id in the query string.)

0

精彩评论

暂无评论...
验证码 换一张
取 消