1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 Redirect mobile users

Discussion in 'XenForo Questions and Support' started by typb, Sep 2, 2014.

  1. typb

    typb Member

    Hello,
    On my xenforo installation I am currently using a portal frontpage to display 'news'.
    I would like it so when a user on a mobile device access my site they are automatically directed to the forums instead of landing on the home page.
    Is this at all possible?
     
  2. rainmotorsports

    rainmotorsports Well-Known Member

    My first question is do you want to do it by effective resolution or what? You might not want to redirect large tablet users for example.

    I actually run a 3 column layout on XenPorta. Ended up using Javascript to move and stack my left column next to the right one on mobile. That way we could still use XenPorta on mobile without the left column going to the top which was crazy.
     
  3. typb

    typb Member

    For a quick fix I don't mind redirecting tablet users, however my main interest is directing people on smaller resolutions.
     
  4. rainmotorsports

    rainmotorsports Well-Known Member

    Wouldn't take much to write a quick jquery script to redirect everyone under a particular effective resolution. So for example the 1080P screen in my cell phone minus the controls is 360x592. The nexus 7 tablet sideways is about 960 pixels in width depending on the year. Id balance that against the minimum size that works for your front page.

    Will want to make sure your using a method that queries the device resolution and not the window resolution.
     
  5. typb

    typb Member

    Thanks for the reply, I've searched the net and found an appropriate script and customised it based on resolutions, where would the appropriate place be to place the script?
     
  6. rainmotorsports

    rainmotorsports Well-Known Member

    The script itself it doesn't matter. The most appropriate place would in the js folder, perhaps inside a folder named after the site or project or whatever.

    As far as the script declaration goes you only want it to show up on that page, otherwise other pages would redirect. Not sure what your using for a portal. But id find the most appropriate place in the base template for that.
     
    typb likes this.
  7. typb

    typb Member

    Thanks for your help!
     

Share This Page