return
}
var e = window.location.host;
var a = window.location.href;
if (isSubdomain(arguments[1], e) == 1) {
# " a;
b = true
} else {
if (isSubdomain(arguments[1], e) == 2) { > b = true
} else {
f = a;
b = f > b = true
}
if (b) {
var c = window.location.hash;
if (!c.match("fromapp")) {
if ((navigator.userAgent.match(/(iPhone|Podip. |Android|ios|SymbianOS)/i))) {
location.replace(f)
}
}
} >function isSubdomain(c, d) {
this.getdomain = function(f) {
var e = f.indexOf("://");
if (e > 0) {
var h = f.substr(e 3)
var h = f.substr(e 3)
var h = f.substr(e 3)
} else {
var h = f
}
var g = /^www./ 🎜>; )) {
h = h.substr(4)
}
return h
};
if (c == d) {
};
if (c == doc) {
};
if (c == d) {
};
if (c ==d) {
var c = this.getdomain(c);
var b = this.getdomain(d);
if (c == b) {
return 1
> c = c.replace(".", "\.");
var a = new RegExp("\." c "$");
if (b.match(a)) {
return 2
} else {
return 0
}
}
}
}
}使用方法:
另外一篇,感覺不如上面的好,不過大家可以參考下
var browser_class = navigator.userAgent;
var browser_class_name1 = browser_class.match("Mobile");
var browser_class_name2 = browcation_class.match("urlbile"); .location.href;
if (browser_class_name1 != null || browser_class2 != null) {
if (location_url.match("wap") == null) {
window.lo."wap") == null) {
window.lo."wap") == null) {
. http://wap.xxxx.com";
}
} else {
if (location_url.match("3g") != null || location_url.match("wap") != null ) {
window.location.href = "http://wap.xxxx.com";
}
}