Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RoR with JavaScript disabled

Is there any fallback mechanisms in Ruby on Rails 3.2 and 4.0 when someone has JavaScript disabled?

How would an application react, specifically when using ajax request. Would it fallback to normal requests?

I ask this because I need a website which also can handle requests from text browsers for disabled people.

What are some strategies if there is no default fallback.

like image 896
mahatmanich Avatar asked Nov 01 '22 14:11

mahatmanich


2 Answers

See this post. Stop loading the page if Javascript is disabled

In general I can't really think about any fallback mechanism here - note that huge part of requests done by rails are in fact ajax requests, as it is impossible to send PUT or DELETE over (Instead of delete request, rails send ajax post request with data: {"_method"="delete"}).

In short, for me disabling JS will break the page heavily, I'm gona test it today.

like image 120
BroiSatse Avatar answered Nov 09 '22 15:11

BroiSatse


I'm not well experienced with RoR, but I suspect this is more a question of how you design your front-end architecture. My limited understanding is that RoR didn't provide any javascript "out of the box"; it's default state is to create views that produce flat HTML, which you can dress up how you like with JS and CSS.

Your HTML should be written such that the user should be able to get to all the content they are most interested in, without having to rely on JavaScript to do it. This means you should only use JS to augment the experience. In the language of common front-end practice, do progressive enhancement.

like image 34
Simon Dell Avatar answered Nov 09 '22 14:11

Simon Dell