Re: [PHP] Detect and Redirect Mobile Users

[email protected] (raphael khaiat)
Newsgroups php.general
Message-ID <CAOq2-0bHRfoTz=toZ01yW_j5zUPDvLjR2E=nTc9fAS4-PPYjZg@mail.gmail.com>
Hi,

On Thu, Jun 13, 2013 at 1:19 AM, dealTek <[email protected]> wrote:

> Hi all,
>
> I'm curious of a simple, common, universal way to detect a mobile user so
> I can redirect them to a mobile directory...
>
> What is best for this: Javascript - CSS - PHP?
>
> I think for my purposes if I can detect screen size or mobile browser
> agent - that would be good enough for what I need right now.
>
> Thanks in advance - Dave
>
>
In my personnal experiences, I've used varnish (for caching mainly) and
for mobile redirection purpose. A few line in your vcl configuration and
there you go. You can even put a rules to indicate that if there is a GET
parameter or a cookie, you don't redirect the user.
It means that you can simply add a link on your mobile website to send
the user back on the desktop website if he prefers.

I like this approach as it is directly on your first frontend (or load
balancer) and you don't even need to load you php app to redirect the
user.

Regards,
--
bacardi55 (bacardi55.org)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.