根据 UserAgent 做页面跳转

1
2
3
4
5
6
7
8
9
10
11
12
13
14
(function(window, undefined) {
'use strict';
var keywords = [
'iPod', 'iPhone', 'Android', 'Opera Mini',
'BlackBerry', 'webOS', 'UCWEB', 'Blazer',
'PSP', 'IEMobile', 'Symbian'
].join('|');
var pa = new RegExp(keywords, 'g');
if ( pa.test(window.navigator) ) {
window.location.href = 'http://m.example.com';
}
})(window);
0%