--> Javascript window.location Method
--> Because mobile phones typically have a small screen width, you can redirect visitors to your mobile site if they have a screen width of less than or equal to 800 pixels. You place this code in the head section of your main website code. That way when your site is visited, the javascript will see the browser width and redirect to the appropriate site
You can use the following code to do this:
<script type="text/javascript">
<!--
if (screen.width <= 800) {
window.location = "http://m.domain.com";
}
//-->
</script>
--> Because mobile phones typically have a small screen width, you can redirect visitors to your mobile site if they have a screen width of less than or equal to 800 pixels. You place this code in the head section of your main website code. That way when your site is visited, the javascript will see the browser width and redirect to the appropriate site
You can use the following code to do this:
<script type="text/javascript">
<!--
if (screen.width <= 800) {
window.location = "http://m.domain.com";
}
//-->
</script>
No comments:
Post a Comment