[OpenLayers-Users] Automatically detecting and deploying mobile OL

jrom jerome.gasperi at gmail.com
Thu Apr 28 16:57:38 EDT 2011


Hi,

You should take a look at http://engine.jeobrowser.com
There are two endpoints : index.html for desktop version and
indext.html for mobile version.
Each endpoint has a custom build of OpenLayers : one desktop version
based on OL 2.10 and one mobile based on the latest trunk of OL.

In the index.hml you can add a simple script to automatically redirect
your user to the mobile version  :

<!-- Redirection based on user agent -->
        <script type="text/javascript">

            var uagent = navigator.userAgent.toLowerCase();
            /*
             * Redirect to mobile version for touch devices
             */
            if (uagent.indexOf("android") != -1 ||
uagent.indexOf("ipad") != -1 || uagent.indexOf("iphone") != -1 ||
uagent.indexOf("ipod") != -1) {
                window.location = 'indext.html';
            }

        </script>


Best regards

Jerome

On Thu, Apr 28, 2011 at 6:45 PM, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:
> I am looking for an example of automatically detecting a mobile browser and deploying the correct OL build and functionality. Right now I am using OL 2.10. I am assuming that I would probably have to move up to a dev version of OL, correct?
>
> --
> Puneet Kishor http://punkish.org
> Researcher http://carbonmodel.org
> Science Fellow http://creativecommons.org_______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
http://jrom.info


More information about the Users mailing list