Hi Alan,
Alan wrote:
I'd like to know what's the best way to find out in RoR if the user's browser has javascript turned off.
I've got a situation I'm handling exactly the same way. In the controller:
def check_js respond_to do |wants| wants.html {redirect_to :action => 'sorry'} wants.js { render :update do |page| page.redirect_to :controller => 'actor', :action => 'edit_patient' end } end end
It's important that the responses be in line with the request. So the html branch needs to respond with html, and the js branch needs to respond with js. You can use an RJS view, or do the render in the controller like above. But you can't render html in the wants.js response or the respond_to won't work.
hth, Bill