Print

Print


The code I'm using (on the server side) is based on the $_SERVER['HTTP_USER_AGENT'] variable -- the providers of the code have gone to a bunch of trouble to parse user agents and discern whether or not they count as mobile devices. It is decidedly imperfect, but it does a good job at least for the mobile devices we're seeing so far. 

In other contexts I also use JavaScript-based detection, but for these functions I'm doing it with the PHP approach. 

ken 

-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of Jonathan Rochkind
Sent: Wednesday, January 02, 2013 3:53 PM
To: [log in to unmask]
Subject: Re: [CODE4LIB] directing users to mobile DBs, was RE: [CODE4LIB] Responsive Web Site Live

Ah, but this still doesn't answer my question on your part, Mark!

How do you detect browser width, especially on the server-side?

If it's with Javascript... the method Ken describes, it's not clear to me how javascript logic could get in there exactly.

Thus my question.

On 1/2/2013 3:51 PM, Mark Pernotto wrote:
> I'd be curious to hear the response to Jonathan's question.  For the 
> longest time, I used to determine mobile  displays by browser, but it 
> just got too cluttered.  Now I detect browser width to determine 
> mobile versions.  This little trick doesn't play nice with all 
> frameworks, however, so it's not bullet-proof, but so far, it has 
> worked well.  And on a high level, easy to troubleshoot.
>
> It wasn't immediately apparent to me if this was a part of a CMS or 
> not - it's awfully clean, and the usual Joomla/Drupal/Wordpress 
> identities weren't visible in the source.  Really nice work!
>
> Thanks,
> Mark
>
>
> On Wed, Jan 2, 2013 at 12:36 PM, Jonathan Rochkind <[log in to unmask]> wrote:
>> What method do you use to detect mobile-or-not?
>>
>>
>> On 1/2/2013 3:33 PM, Ken Irwin wrote:
>>>
>>> Sarah asks about how to direct users to mobile versions of databases 
>>> where appropriate.
>>>
>>> The way I'm doing it is:
>>> 1. All database links are served up from a database table, so the 
>>> link on our website is http://$OUR_LIBRARY/redirect?$db_id
>>> 2. The db-of-dbs knows if there is a mobile specific url (because we 
>>> put it there...) 3. Detect mobile-or-not as a binary value 4. Serve 
>>> up the right one as an HTTP header redirect
>>>
>>> One big exception: EBSCO (which provides a really large number of 
>>> our
>>> databases) handles their mobile access by using the same URL with a 
>>> different profile name in the url. The redirect script has a special 
>>> case that says if ($mobile = true and $ebsco = true) { do string 
>>> replace on the url to change from the desktop url to the mobile url 
>>> } -- so I don't have to list both versions of the URL in the database.
>>>
>>> It seems to work out pretty well.
>>>
>>> Ken
>>>
>>> -----Original Message-----
>>> From: Code for Libraries [mailto:[log in to unmask]] On Behalf 
>>> Of Sarah Dooley
>>> Sent: Wednesday, January 02, 2013 3:25 PM
>>> To: [log in to unmask]
>>> Subject: Re: [CODE4LIB] Responsive Web Site Live
>>>
>>> Very cool--congratulations!
>>>
>>> In addition to Dave's questions, I'd be curious to know (can't see 
>>> it since I don't have a login) how you handled directing people to 
>>> databases that have mobile versions. This is something I've been 
>>> wondering about for our site down the road and library sites in 
>>> general--from a responsive site, how to effectively link people out 
>>> to vendor-provided resources that are either mobile or non-mobile.
>>>
>>> -Sarah Dooley
>>>
>>>
>>
>
>