views:

38

answers:

2

We are in the process of building a huge site. We are contemplating on whether to do the processing of HTML at server side (ASP .Net) or at the client side.

For example we have HTML files which acts like templates for the generation of tabs. Is it better for the server side to get hold of content section (div) of HTML load the appropriate values and send the updated HTML to the browser or is it better that a chunk of data is passed onto client and make Javascript do the work?

Any justification with respect to either ways will be helpful.

Thanks.

+3  A: 

My opinion: Do it on server side. We are putting enough JavaScript strain on the client as it is, making sites unusable on machines only a few years old. Plus, you are likely to lock out users with Javascript disabled, and users on weaker clients (e.g. the iPhone.)

Pekka
Yup I agree. We already have a bunch of Javascript files (client is ok with it and we have mechanism to navigate users who have JS disabled to show them how to enable it). We did a cost benefit analysis to code for Browsers with Disabled JS and the cost was more than the benefit to code for that scenario. Anyways thanks for your insight.
Raja
I'd also add that if you do it server side you have to be compatible with ONE environment. If you do it client side, you have to be compatible with many.
Russell Steen
@Russell : Makes pretty good sense :-)
Raja
@Russell good point.
Pekka
+2  A: 

Do not use javascript for vital work.

It is very easy to disable it for the end user and then you page would not work. You should always (at least for bigger sites) make a page compatible for when you disable JS.

On the other hand it is nice to have some validation etc in JS because then you can stop them before the page reloads thus reducing the pressure on your servers and the load time for the user. But remember to always have a backup validation on the server side. You do not want to validate for empty entries solely on JS side because then empty entries can be posted if you have disabled JS

Oskar Kjellin
We already validate both at client side and the server side. Thanks for the info though :-)
Raja