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

    Nov 6, 2010
    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 ..

    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


    Jan 16, 2002
    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.


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


    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

    Nov 6, 2010
    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

    Nov 8, 2010
    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.

  5. notjustjay macrumors 603


    Sep 19, 2003
    Canada, eh?
    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