[JAVASCRIPT | Weiterleitung mobiler Geräte] Leitet Besucher mit mobilen Geräten auf mobile.html, auf Wunsch auch so spezifisch, dass nur iPhones / iPads weitergeleitet werden (redirect-iphone.js). #Weiche #Mobilgerät #Gerät #geräteabhängig #Weiterleitung #Redirect #Smartphone #Mobiltelefon #DesktopPC #HTML #JavaScript
<html>
<head>
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
</head>
<body>
<h1>
Wird nur auf Desktop PCs und Tablets angezeigt.
</h1>
</body>
</html>
<html>
<head>
<script type="text/javascript">
<!--
if (screen.width => 699) {
document.location = "index.html";
}
//-->
</script>
</head>
<body>
<h1>
Wird nur auf mobilen Geräten angezeigt.
</h1>
</body>
</html>
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://url-to-send-them/iphone.html");
}
if (screen.width <= 699) {
document.location = "mobile.html";
}