how to automatically redirect to mac or windows pages ?

Discussion in 'Web Design and Development' started by bader rashed, Nov 6, 2010.

  1. bader rashed macrumors newbie

    Joined:
    Nov 6, 2010
    #1
    Above all .. thanks for this wonderful website ...

    and ,, i have website for free softwares

    it has 2 section one for mac software and the second for windows softwares ,,

    i want do like .. www.download.com

    if the visitor has Mac i want automatically redirect to section for mac softwares ..

    if the visitor has windows i want automatically redirect to section for windows softwares ..

    i hope found the correct way here .. because i've search a lot in google but i don't found it there ..


    thanks ...
     
  2. bbarnhart, Nov 6, 2010
    Last edited: Nov 6, 2010

    bbarnhart macrumors 6502a

    bbarnhart

    Joined:
    Jan 16, 2002
    Location:
    Stilwell, Kansas
    #2
    Several headers are generally sent with each web request. One of these is called User-Agent. That will tell you if the browser is on a Mac or PC.

    Example

    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12

    Visit

    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    for more information

    If you're wanting to send a redirect to the browser, you can send a 302 response code with the new url.
     
  3. bader rashed thread starter macrumors newbie

    Joined:
    Nov 6, 2010
    #3
    thank you bbarnhart ...

    I read a lot about User-Agent ... but really i dont understand :eek:

    so what is the code can i write it to redirect mac user to specificity page


    thank you
     
  4. robgbne macrumors newbie

    Joined:
    Nov 8, 2010
    #4
    Just because a visitor is using a Mac doesn't mean they want to go to the Mac section, same for those using Windows. Consider setting a cookie when they go to one section or the other and return them to the same section next time they visit.

    --
    Rob
     
  5. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #5
    Yep. Or making the Mac link (or PC link) nice and big and prominent, "we think this is the link you want", but still offer the other link somewhere just below it just in case. Or present it as a list/drop-down of choices, but move their user-agent platform to the top of the list.

    bader_rashed, what language are you coding this in?
     

Share This Page