开发者

Is it better to have client (Javascript) processing HTML rather than C# processing HTML?

开发者 https://www.devze.com 2022-12-23 15:16 出处:网络
We are in the process of building a huge site. We are contemplating on whether to do the processi开发者_Python百科ng of HTML at server side (ASP .Net) or at the client side.

We are in the process of building a huge site. We are contemplating on whether to do the processi开发者_Python百科ng 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.


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


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

0

精彩评论

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

关注公众号