Re: Redirect with User Agent
You post was moderated which means only the moderators can see it first.
It is approved now and I think you should have a few suggestions before too long. :)
Re: Redirect with User Agent
Thanks gwpriester... I hope so! :)
Not sure why but I ended up using "Portable" when I meant Phone/Mobile in my original post.
But this should not really matter for what I am hoping to accomplish!
Re: Redirect with User Agent
Re: Redirect with User Agent
Thanks Acorn... But now I'm even more confused than before! :eek:
Looking at that list I have no idea what to make of it or how to implement it.
Perhaps I really am dumber than I look?
Re: Redirect with User Agent
From what I read of your code, your are inviting the user's browser to identify itself.
The for xx in search_strings is a way of finding a fragment of a phrase that describe the browser.
I was suggesting you set up an array for a third set of search strings using the Mobile Browsers list at the given URL, where you have a loop for (k in search_strings) { ...} coupled with if (detect()) window.location = "http://yourwebsite.com/tablet/";.
You could also point any tablet you have to http://whatsmyuseragent.com/ and examine the userAgent string that returns.
Perhaps we should all contribute our device's userAgents here?
As I'm on a computer, using Chrome, I'm showing
Quote:
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
Acorn
Re: Redirect with User Agent
An alternative may be to ask the device what its pixel width and height are, but I have never played with mobiles to check what's the best way.
Look at http://www.javascriptkit.com/howto/newtech3.shtml form a tablet or phone to see if window.screen is a general method.
Acorn
Re: Redirect with User Agent
Alright... Thank you for your input.
I will see if I can figure it out with this new info.
Never got into all the code going on behind the scenes...
And can be quite overwhelming as I found out!
Re: Redirect with User Agent
I think I figured it out. Went with the following solution:
Replaced "android" with "mobile" in the variable i. Both browsers I tried on Android phone had "mobile" in their user agent... so still works.
Then looked for just "android" in a new variable k. If present it gets forwarded to the tablet version... works!
Thanks for pointing me to the websites. Sure helped! :D
Richard
Re: Redirect with User Agent
See, I told you someone would have some suggestions. :)