JavaScript Detect Device in ASP.net
JavaScript Detect Device in ASP.net
Simple put the JavaScript in your default page and see the result in your different browser .
Redirect Mobile Devices
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
"mobile.html" would be replaced with the location of wherever your mobile version resides. This technique could be adapted to load an alternate stylesheet as well.
For iPhones/iPods Specifically
<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://localhost/iphone.html");
}
-->
</script>
Enjoy script....
Simple put the JavaScript in your default page and see the result in your different browser .
Redirect Mobile Devices
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
"mobile.html" would be replaced with the location of wherever your mobile version resides. This technique could be adapted to load an alternate stylesheet as well.
For iPhones/iPods Specifically
<script language=javascript>
<!--
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://localhost/iphone.html");
}
-->
</script>
Enjoy script....
Comments
Post a Comment