Announcement Announcement Module
Collapse
No announcement yet.
Touchscreen devices Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Touchscreen devices

    I am trying to use a javascript library which requires two additions to my JSP for touchscreen devices.

    Note: At present I am using Spring MVC.

    Code:
    In the head section:
    
    <link rel="stylesheet" href="/scheduler/ext/dhtmlxscheduler_touch.css" type="text/css" charset="utf-8">
    
    In the body section:
    
    <script src="/scheduler/ext/dhtmlxscheduler_touch.js" type="text/javascript" charset="utf-8"></script>

    It is not clear to me.

    1) Is 'spring mobile' the way to achieve this ?

    2) If so how do I distingish touchscreen devices ?

    3) If the answers above means I use the "WNG tag library" can I just place tags around the <script> / <link> sections I need or do I need to provide a complete WNG jsp ?

    Thanks in advance.

  • #2
    Are you looking to conditionally include the CSS and script if the client is a mobile device? If so, yes, you can use Spring Mobile for device detection and then test the currentDevice.mobile or currentSitePreference.mobile attribute in your JSP. The spring-mobile-samples lite-showcase shows this e.g. http://git.springsource.org/spring-m...ome-mobile.jsp.
    Last edited by Keith Donald; May 11th, 2011, 09:35 AM.

    Comment


    • #3
      Thanks I will give this a go.

      Can you get more details eg. whether the device has a touchscreen ? As it appears the CSS/JS files mentioned above are for touchscreen devices only.

      Thanks again,

      Comment


      • #4
        Well, you could look at plugging in WURFL or Atlas, device databases that can answer capability questions like that on the server-side. However, I would first check and see if whatever JavaScript library you're integrating performs any feature detection client-side to see if the user agent is compatible. If so, you may be able to rely on client side feature detection exclusively, and not have to do anything special on the server.

        Keith

        Comment


        • #5
          There is a javascript library called Modernizr that can help detect certain features on client-side and accordingly load the relevant JS files that exploit that functionality.

          Comment

          Working...
          X