[ic] Specify flypage using javascript or another non-database method

Peter peter at pajamian.dhs.org
Sun Apr 26 23:41:42 UTC 2015

On 04/27/2015 07:10 AM, DB wrote:
>>> Hi all. I'm working an making IC5 site a bit more mobile friendly and so
>>> far it's been fairly painless. Using javascript to redirect mobile
>>> visitors to the mobile version of a page works well. But I now need a
>>> way to make mobile visitors see a different flypage than non-mobile
>>> visitors see.

> Thanks - I'd been using something like below but I see other ways in the
> archives that would probably work better with your example.
> <script type="text/javascript">
> <!--
> if (screen.width <= 699) {
> ...
> }
> //-->
> </script>

Using javascript is all well and good, but you do have to direct them
after the page is loaded and then load another page as a result.  If you
use server-side code to detect the presence of a mobile based on the
UserAgent string then you can use Mike's code above to do it without
needing a redirect.  I suggest using the HTTP::BrowserDetect module to
parse the useragent string for you.  It has, among others, methods that
tell you if it's a mobile device and whether it's a tablet, etc.


More information about the interchange-users mailing list