ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

[Solved] MX Mobile Detect leaves me in an endless loop

May 20, 2011 4:22am

Subscribe [3]
  • #1 / May 20, 2011 4:22am

    rebellion

    14 posts

    I’m using Leevi Grahams NSM Config Bootstrap to server different templates to mobile users.

    domain.com = Full site for desktop users
    m.domain.com = Mobile site

    There is no automatic redirect in the bootstrap config, so what I’m using is MX Mobile Detect for detecting if template is requested by a mobile device. If true, that will redirect you to the mobile site. If false it serves you the full side.

    My problem is that when accessing the full site on a mobile phone it redirects me to the mobile site. So far so good. But then it redirects me back to the full site, and I’m stuck in an endless loop.

    The only code I’ve defined in my templates is:

    Full site header template:

    {exp:mobile_detect location="http://m.domain.com" redirect="mobile"}

    Mobile site header template:

    {exp:mobile_detect location="http://domain.com" redirect="not_mobile"}

    Any ideas why I’m stuck in a loop? As far as I can see, mobile phones are redirected to full site when accessing full site and desktop users are redirected to full site when accessing mobile site.

    Edit: It’s only mobile requests that get redirected, not desktop browsers.

  • #2 / May 20, 2011 4:48am

    Max Lazar

    341 posts

    ? You want to give users possibility to see full site version on mobile devices?

  • #3 / May 20, 2011 4:52am

    rebellion

    14 posts

    Nah, the opposite. If I’ve not misunderstood anything redirect=“mobile” will redirect mobile users to the mobile version of the site, and redirect=“not_mobile” will redirect desktop users to the desktop version.

    Is that correct?

  • #4 / May 20, 2011 6:03am

    Max Lazar

    341 posts

    could you please try version in attachment?
    Thanks!

  • #5 / May 20, 2011 6:05am

    rebellion

    14 posts

    Yeah, that one works!

    What was causing the loop?

  • #6 / May 20, 2011 6:58am

    Max Lazar

    341 posts

    my misprinting in conditions…

  • #7 / May 20, 2011 7:09am

    rebellion

    14 posts

    Oh, okay 😊 Well, it works like a charm! Thank you so much for your help! 😊

  • #8 / Jul 13, 2012 5:40pm

    Is this for EE2.x ?  Have you patched the EE 1.x compatible code ?  (Yes, we are still running 1.6.8 ...)

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases