ASP.NET MVC, JSON & non JavaScript clients

前端 未结 2 1559
伪装坚强ぢ
伪装坚强ぢ 2021-02-10 09:19

I need to ensure that an application I am developing is accessable and also works with JavaScript turned off. I just need a pointer to assist with the following.

I had 3

2条回答
  •  天命终不由人
    2021-02-10 10:08

    (ref. your previous answer): You could pass a value in your Request.Form to signal that this is a browser with or without javascript enabled, and then create a controller factory that will instantiate the appropriated controller according to what you get in Request.Form; a default controller for regular requests (browsers with javascript enabled) and a "Fallback controller" that only returns full views instead. I am not sure if having twice the number of controllers is better than those if-else statements around a single controller, but I guess it's a question of personal preference.

    I bet there are simpler solutions, though..I wish this question had more exposure.

提交回复
热议问题