问题
I used the following script to redirect mobile users to a mobile site:
<script type="text/javascript">
if (screen.width < 800) {
var ref = document.referrer;
var urls = new Array("http://www.ilsanlorenzo.net","http://www.ilsanlorenzo.net/mobsite");
var n = ref.match(urls[0]);
var m = ref.match(urls[1]);
if ((m!==null) || (n!==null)) {
stop;
} else if (ref=='') {
var r = confirm("Small Display is Detected.\nClick \"OK\" for MOBILE SITE.");
if (r==true) {
window.location = "http://www.ilsanlorenzo.net/mobsite";
} else {
stop;
}
} else {
window.location = "http://www.ilsanlorenzo.net/mobsite";
}
}
</script>
I would like to know if anyone knows a script to redirect mobile users to a mobile site version and tablet and desktop users to a web site version. Does anyone know a solution?
Thanks for your time!
来源:https://stackoverflow.com/questions/16884056/how-redirect-mobile-users-to-different-url