Use the HTML 4-specified
The “click here” link should point to an action in your web application whose job is to set a flag in the user’s session and then bring them back to where they were. In the Ruby On Rails world that looks like this:
def nojs session[:nojs]=1 redirect_to(request.referer ? :back : '/') end
I define this action in my
ApplicationController. The call to
redirect_to(:back) only works if the user agent has set the
HTTP Referer header, so we check for that first.
Render views based on the session variable
Based on what the user has told me I can now present a view that will work for them. For example, here’s some code that generates a select box to change the number of items viewed on a page:
<% form_tag(change_page_path) do %> <select name="page_size" id="page_size" onchange="this.form.submit();"> <% for i in (25..100).step(25) %> <option value="<%= i %>"><%= i %></option> <% end %> </select> <%= submit_tag('Change Size') if session[:nojs] %> <% end %>
Caveats & thoughts
What do you think? Is it too much to ask that a link be clicked in hopes of providing a great web page?
Incoming search terms:
- number of users mightyvites com
- js disabled get user to enable it