Different Redirects Based on Browser

Hi
I wanted to check if anyone is aware of a portal or website which gives me one link but different results for different browser.

Comments

  • +1 vote

    Not quite what you're asking for, but I had a similar problem when trying to segregate ios/android/regular users with a single link.

    Found that short.io was the most effective solution, lets you customize the final URL based on ios/android/regular, and also has a feature for segregating by country.

    •  

      Thank you

  • +6 votes

    Hi Welcome StackOzbargainflow… ? What browsers are you meaning exactly?

    •  

      Safari open one link and Chrome opens the other

  •  

    Have heard some sites (ie. flight booking) alter their prices based on your user agent. Something like if you are using an iOS device, you get higher prices returned.

  • +1 vote

    If you already have website hosting, maybe chuck up a little PHP script to do it. Otherwise maybe a free host or free tier cloud service. You can probably fine a copy/paste example for it on stack overflow.

    •  

      Can you help with an example please?

      • +1 vote

        As a dev, I'm going to straight up tell you that trying to separate links based on user agent (browser) is horrible practice. A million ways for it to break, easily bypassed with a few seconds of effort as anyone can spoof their user agent, and it'll always be on the backfoot with updates.

        If you're trying to compensate for some browsers having missing features then you should do feature testing as that'll always remain current, check out modernizr, it gives a great rundown of how and why: https://modernizr.com/docs

        If you want to compensate for how different rendering engines work (i.e. webkit (safari, chrome on ios only) vs Blink (chrome, edge, brave, opera etc) vs trident (ie)) then test for that as it'll be slightly more future proof given they rarely change. https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_de...

        If you really really need to only give different links for safari vs chrome vs edge, then you can also test for that in the user agent, but it will break and will need to be constantly updated to account for new browsers and browser updates: https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_de...

  • +1 vote

    You can serve different content for different User-Agent request header.

    •  

      Do you have any example of the code please