I have no mobile device to test on. Which are you using? What's its navigator.userAgent string look like? Does it contain any of the keywords that the regular expression tests for? To find out, use a simple page:
Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script type="text/javascript">
document.write(navigator.userAgent);
</script>
</body>
</html>
A simulator might not report the the navigator.userAgent. Although it should, all it's technically required to do is to render as that agent. To find out, again one can run the simple test page above.
Anyways, try this:
Code:
<script type="text/javascript">
if (/android|blackberry|iphone|ipod|mini|palm|series60|symbian|windows ce/i.test(navigator.userAgent)){
location.href = "mobile.html";
}
</script>
Oh, and what does this:
i have from in detecting mobile platform
mean?
Bookmarks