[Web4lib] Mobile identification code

Thomas Bennett bennetttm at appstate.edu
Wed Aug 25 11:08:39 EDT 2010


We have a javascript between <head> and </head>

<script>
if((navigator.userAgent.match(/iPhone/i)) || 
(navigator.userAgent.match(/iPod/i))) {
	 if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location 
= "http://m.library.appstate.edu/";
}
</script>

This only works for the iPhone/iPod.  it would be simple enough to add in for 
other devices but you would have to do it for each different browser identified.

Found this in nytimes.com

<link rel="alternate" media="handheld" href="http://mobile.nytimes.com"> 

In an email to this list earlier this year showed where one library had to 
write something like 8 apps or more for mobile users so they could cover the 
major vendors of phones.  But this was apps for the phones.

Also, there are broswers for phones that let the user decide which sites to 
view.  Such as Skyfire where you can choose to view as desktop or mobile.  
There's Dolphin and Opera Mini where you can toggle mobile view.   I use these 
on Droid.


Thomas



On Wednesday 25 August 2010 10:02:08 Dawn Work MaKinne wrote:
> I don't know to which e-list I should be directing this question. I need
>  the snippet of code that needs to head our Home Page that knows how to
>  identify an incoming user as a mobile user and will direct that user
>  automatically to our mobile site. Is this a fairly direct piece of code,
>  or is it pretty complex? Please let me know what list I need to join to
>  get the answer to this question. Thank you!
> 
> Dawn Work-MaKinne
> 
> 
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
> 

-- 
==========================================
Thomas McMillan Grant Bennett           Appalachian State University
Operations & Systems Analyst            P O Box 32026
University Library                                Boone, North Carolina 28608
(828) 262 6587

Library Systems Help Desk: https://www.library.appstate.edu/help/
==========================================




More information about the Web4lib mailing list