Question

I'm working on an existing MVC project and I'm currently looking at using the display modes features. I'm hoping that the final application will be able to return three different types of view.

  • Mobile - Mobile phones, IE6/7,
  • Non-JavaScript browsers - Tablet
  • Tablet browsers Desktop - Desktop browsers

Everything is simple enough except the JavaScript detection.

Currently it's a desktop application that gracefully degrades. This is great but takes a lot of time to support Non-JavaScript users (which is only 2% of our audience and most of these are probably bots). So I want to give the non-JavaScript users the basic mobile version of the site which should be less effort to support.

I understand that something will have to be rendered client side and then a redirect. But what is the best way to do this? Do I default to mobile and redirect with JavaScript or do I do something with <noscript> tags?

Thanks for any help

Was it helpful?

Solution

In your scenario using <noscript> tags in combination with a meta refresh is probably what you want:

<head>

  <noscript>
    <meta http-equiv="refresh" content="0; url=http://example.com/mobile" />
  </noscript>

</head>

I wouldn't recommend doing it the other way around (first loading the mobile and redirect with JavaScript) because as you said the non-JS users are only 2% and that would just add unnecessary overhead for all your other users.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top