Hi everyone. I'm trying to find some script to redirect Blackberries to our mobile site automatically. I found some javascript that works for iPhones - it just reads the screen width (<=699) and redirects with document.location="http://www.mymobilesite.htm". But this doesn't work with Blackberries. Here's the statement I'm trying.

<script type="text/javascript">
<!--
if ((screen.width <= 800) || (navigator.useragent.match(/blackberry/i)) {
document.location = "mypageurlhere.htm";
}
//-->
</script>

I'd heard that Blackberries don't read javascript at all, but I found this code out there - plus the Blackberry site says that useragent detection in javascript should work! Maybe it's just a syntax error?

I'm not working with PHP or anything fancy and good, just HTML.

So I'm baffled. If it's just plain impossible, how come no one seems to say that either?

Thanks everyone. Hope someone can help.