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!
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!
Last edited by dutchim; 02 February 2014 at 01:32 PM.
You can possibly work from the lists here: http://www.useragentstring.com/pages...gentstring.php
Acorn
Thanks Acorn... But now I'm even more confused than before!
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?
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 showingAcornMozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
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
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!
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!
Richard
Bookmarks