Announcement Announcement Module
Collapse
No announcement yet.
How can I let my website auto change when user login as mobile? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I let my website auto change when user login as mobile?

    I have a website ! and then , I design 1 theme for mobile, but I still don't know how can my website auto change when user login with mobile (iOS or Android)
    Someone can tell me how, because I need it !
    Thanks a lot

    Vicky

  • #2
    Reading Spring Mobile document thoroughly seems a good idea/entry point, but concisely, you can serve different views for different devices. Like mentioned in spring mobile documents you can do the following, though there is smarter ways of achieving this IMO.

    Code:
    @Controller
    public class HomeController {
    
        @RequestMapping("/")
        public void home(Device device) {
            if (device.isMobile()) {
                // Redirect to your mobile page, which have proper style/theme included
            } else if (device.isTablet()) {
                // Redirect to your Tablet page
            } else {
                // Normal desktop page.
            }
        }
    
    }

    Comment


    • #3
      Doing the detection in the Controller is one option that Spring Mobile provides. Another option is to use the LiteDeviceDelegatingViewResolver.

      Comment

      Working...
      X