Welcome to TalkGraphics.com
Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,882

    Default 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
    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
    Acorn

  2. #2
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,882

    Default 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

  3. #3
    Join Date
    Jan 2014
    Location
    Savannah, Georgia Area
    Posts
    309

    Default 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!

  4. #4
    Join Date
    Jan 2014
    Location
    Savannah, Georgia Area
    Posts
    309

    Default 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!

    Richard

  5. #5
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,518

    Default Re: Redirect with User Agent

    See, I told you someone would have some suggestions.

  6. #6
    Join Date
    Jan 2014
    Location
    Savannah, Georgia Area
    Posts
    309

    Default Re: Redirect with User Agent

    Yup... And I didn't even have to get up!

    Thanks again

 

 

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •