[Seaside] Detecting mobile devices

bobn at rogers.com bobn at rogers.com
Thu Sep 29 13:43:01 UTC 2011


I used the following code for a demo (VW 7.7.1 + Seaside 3.0). 
The redirection was from a root dispatcher application to separate Seaside applications in the same image.

| string | string := self requestContext request userAgent.(string includesSubString: 'iPad') ifTrue: [^self requestContext redirectTo: self tabletURL].
(string includesSubString: 'iPhone') ifTrue: [^self requestContext redirectTo: self phoneURL].
(string includesSubString: 'webOS') ifTrue: [^self requestContext redirectTo: self tabletURL].
^self requestContext redirectTo: self portalURL


Bob N.


________________________________
From: Nevin Pratt <nevin at bountifulbaby.com>
To: Seaside - general discussion <seaside at lists.squeakfoundation.org>
Sent: Tuesday, September 27, 2011 4:44:25 PM
Subject: [Seaside] Detecting mobile devices

If you Google this topic, you will find sample code for this, but of course it would need to be adapted to Seaside.

Probably not too difficult of a task, but before doing so, I thought I'd ask if anybody had some Seaside code that would detect mobile devices.

Yes, this is browser sniffing, which historically hasn't been super reliable.  But a lot of sites are now auto-detecting if, say, you are on an iPhone, or an Android phone, and automatically giving the user a mobile version of the website.  It's getting to be pretty common.

So, does anybody have any (reasonably reliable) Seaside code for detecting mobile devices?

Nevin

_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110929/f78581a5/attachment.htm


More information about the seaside mailing list