문제

I've created a website which contains experimental HTML5 stuff. So old browsers can't display it.

Now I want to detect if it is an old browser which the visitor uses and redirect it to a subfolder called "/old", where I display my website as a non-HTML5 website and display a hint that the user is using an old browser.

How can I redirect the user if he's using an old browser?

도움이 되었습니까?

해결책

Use Modernizr

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

Why use Modernizr?

Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily.

다른 팁

You should never detect browsers. Insted detect features browser support. Here's a good article on how to do this: Detecting HTML5 Features

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top