joshua-anderson
joshua-anderson

Reputation: 4466

Is there any way to check for browser javascript support in sinatra?

I was wondering if there was any way to check for browser javascript support in sinatra so I can feed it into a template, allowing me to create js and non js page version.

Upvotes: 0

Views: 46

Answers (1)

Amadan
Amadan

Reputation: 198446

No, you can't test for JavaScript on serverside. What you can do is render a page that has a JS redirect:

window.location.replace("index-with-js.html");

You will land on the JS version only if the redirect is executed, which effectively tests for JS support.

Upvotes: 1

Related Questions