1

So I need to set up mobile redirect for a Drupal 7 site I've been working on, but there are some conditions and I can't quite decide what the best route would be. Basically, if the user is browsing the site on mobile, we need to redirect to m.example.com - However, we also want this to NOT happen if the user is browsing within the "Events" section of our site "example.com/events," but there is also a link ON the mobile site to view the full page and redirects to "example.com/?nomobile=true" and if the user follows this link we want to break the redirect

Given these conditions, does anyone know the best course of action? Whether it's a module that can be configured (Simple Mobile Redirect doesn't seem to be flexible enough to handle all of this), or some kind of PHP code - I tried doing this with JavaScript but the redirect just doesn't seem to fire (even though the console.logs within the function are returned, so I don't think that will work.)

Much appreciated

1
  • 1
    Whoops, ignore this, it turns out the JavaScript actually is working but wasn't originally due to some kind of cache setting
    – Ryan
    Nov 6, 2012 at 20:33

1 Answer 1

1

The Context module will allow you to create contexts and set reactions for each context.

A context can be anything:

  • User has this role
  • The page is a taxonomy term page
  • The visitor is using a mobile

You will need these modules:


Another option is to use the Omega Theme which is a fully featured responsive base theme, it looks a little bit complicated at first but the documentation is excellent.

PS: You will still use the Context module, you can find how on the documentation.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.