[erlang-questions] cowboy: dispatch on chrome/firefox vs android/iphone

Loïc Hoguin essen@REDACTED
Mon Apr 14 18:46:31 CEST 2014


The correct answer is *Don't do this*. *Seriously don't*. And if you 
*do* end up doing it, make sure you put a link to the desktop version so 
that I can use a version of your website that works properly and not the 
mobile one.

Also lookup: graceful degradation, facilitated by frameworks like 
Bootstrap, jQuery mobile, etc. And doing it this way is also less work 
for you!

On 04/14/2014 06:41 PM, t x wrote:
> Understood -- I asked the wrong question. The correct answer is "do
> this client side; don't do this server side."
>
> On Mon, Apr 14, 2014 at 1:58 AM, Bogdan B <bogdan@REDACTED> wrote:
>> Browser sniffing is considered bad in general and very bad today with so
>> many variations of browser headers.
>> Maybe you can change the a bit the approach and first load a page that
>> detects browser capabilities with JS (like a 'loading..' page) and makes a
>> second call for the right template.
>>
>>
>>
>> On 13 April 2014 07:09, Barco You <barcojie@REDACTED> wrote:
>>>
>>> No. I think you have to parse the HTTP Header by yourself and then return
>>> corresponding body as "desktop.html" or "mobile.html"
>>>
>>> Barco
>>>
>>>
>>> On Sat, Apr 12, 2014 at 8:48 AM, t x <txrev319@REDACTED> wrote:
>>>>
>>>> Hi,
>>>>
>>>>    Using cowboy, is there a easy way to, for:
>>>>
>>>>    mysite.com/ serve
>>>>
>>>>    * ~/static/desktop.html if browser = chrome/firefox
>>>>    * ~/static/mobile.html if browser = android/iphone ?
>>>>
>>>>    (Sample code to steal would be ideal; though functions to lookup
>>>> suffices too.)
>>>>
>>>> Thanks!
>>>> _______________________________________________
>>>> erlang-questions mailing list
>>>> erlang-questions@REDACTED
>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list