Graceful degradation with angular/ rails

angularjs, javascript, ruby-on-rails

Solution

You can redirect the client to another URL (that executes an Rails controller) and set a default layout with no Javascript.

<head>
    <!-- title, scripts, css etc go here -->
    <noscript>
        <meta http-equiv="refresh" content="2;url=http://yoururlgoeshere.com/yourcontroller">
    </noscript>
</head>

This works well with crawlers like googlebot and etc. With this you decrease the traffic of your server when your site indexed by a search engine because you can leave out css files, image files and js files.

I hope this helps.

Problem

I have two versions of a page: one written using angular, another without any javascript at all. How could I get rails to detect if the client has javascript disabled (or is a googlebot) and serve up the page with no javascript?

Original source

Related problems