zrazak
asked on
Mobile Page redirection
Is there any way this code can be implement if its a mobile website jump to a mobile page else
jump to a desktop page. Can the media query code be implemented in any way to do so since media query is checking if is a mobile device then jump to mobile version?
Any Help is greatly appreciated.
jump to a desktop page. Can the media query code be implemented in any way to do so since media query is checking if is a mobile device then jump to mobile version?
Any Help is greatly appreciated.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title></title>
<link rel="stylesheet" type="text/css" href="mobile.css" />
<link rel="stylesheet" type="text/css" href="desktop.css" />
<style type="text/css">
@media only screen and (max-width: 480px), only screen and (max-device-width: 480px), only screen and (max-device-width: 800px){
#mobile { text-transform:capitalize }
</style>
<script src="Script/jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
mobileResize();
$(window).resize(function () {
mobileResize();
});
});
function mobileResize() {
if ($("#mobile").css("text-transform") == "capitalize") {
$("#mobile").css("display", "block");
$("#desktop").css("display", "none");
} else {
$("#mobile").css("display", "none");
$("#desktop").css("display", "block");
}
}
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<h1>This device is: </h1>
<div id="desktop">Desktop</div>
<div id="mobile">Mobile</div>
</div>
</form>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER