Reputation: 69
I've had mobile device redirection for quite a while now, but something that's bugged me is that (to the best of my knowledge) Windows Phone users aren't being redirected.
My question is, How do I redirect Windows Phone users?<script>
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) )
{ window.location = "http://m.ctworkshop.us/"; }
</script>
Is it possible? What name would I add to do so, if it is?
Ps. adding "Windows" to that list redirects desktop Windows which I don't want to do.Upvotes: 1
Views: 122
Reputation: 5537
How about
navigator.userAgent.match(/Windows Phone/i)
Here's a blog post from a Microsoft employee about correctly detecting Windows phones which uses the same strategy.
Upvotes: 1