1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Mobile Browser Style Switch

Discussion in 'Add-on Releases [Archive]' started by Cezz, Aug 21, 2011.

  1. Cezz

    Cezz Well-Known Member

    This is a very simple modification that detects if the user is currently on a mobile browser, and if so sets the styleid to your mobile style.

    Please note that this is a very early version of this particular modification and currently has only two options...
    1. Style ID (For the Style you want to set)
    2. User Agent Idents (a comma delimited list of mobile user agent idents you wants to check for)
    I plan to add more features to this, including but not exclusively

    • Ability for visitor to overwrite the change and view the full site.
    • Default to no overwrite of style but prompt visitor to change.
    • Ability to exclude certain Controllers from the style overwrite (E.G. if the mobile style isn't coded very well for your homepage, you could use the standard style for that and a mobile style for the rest of the site!)
    If you have any more suggestions then let me know.
    Installation Instructions :-
    1. Download and Extract .zip file.
    2. Upload contents of Upload folder to your forum root.
    3. Import the .xml file into your admin control panel.
    4. Set the style ID and User Agent Ident fields as desired.
    That is it, nice and simple!

    Attached Files:

  2. Cezz

    Cezz Well-Known Member

    Fuhrmann and black hawk like this.
  3. a legacy reborn

    a legacy reborn Well-Known Member

    Nice mod :p, still waiting for a better looking Mobile Style before using this though.
    Ranger375 and black hawk like this.
  4. Russ

    Russ Well-Known Member

    Working beautifully! Thanks Cezz
    Cezz and black hawk like this.
  5. HoddzDJ

    HoddzDJ Active Member

    Thanks for building Cezz. Marked for install when I'm nextvat my PC!
  6. ShadyX

    ShadyX Well-Known Member

    I have been waiting for this for a while, I will be installing it later today! :D
  7. Cezz

    Cezz Well-Known Member

    Your all more than welcome, for those of you who have installed how are you finding it?

    Do you have any suggestions other than what I listed in the first post?
  8. glorify

    glorify Well-Known Member

    What mobile style is everyone using?

    Will try it out, Thanks :)
  9. Cezz

    Cezz Well-Known Member

    a few are using xfstop but it is outdated and not complete. This is more there for when there is a decent mobile style... Though I suspect this mod will become obsolete once the official mobile style is released!
    Lucas and glorify like this.
  10. HoddzDJ

    HoddzDJ Active Member

    I just wonder if when the mobile style is released, if it will automatically switch to that or if we will still need this mod to change it! I still haven't got it installed yet, but I will ASAP and come back to give my views of it, looks sweet though :)
  11. James

    James Well-Known Member

    Have you looked at XenForo_Visitor::isBrowsingWith($browser)?

    You could (I think) do something like:
    // set style
  12. Carl

    Carl Well-Known Member

    Negative nelly.
  13. Russ

    Russ Well-Known Member

    It is technically from Beta 4 :)
  14. tmb

    tmb Active Member

    Excellent work.

    Anyone know what to put in for blackberry? The other mobile users are having no issue but can't get the right agent for blackberry.
  15. Russ

    Russ Well-Known Member

    Found a list here: http://www.dannyherran.com/2011/02/...t-with-php-ipad-iphone-blackberry-and-others/

    Hope it works well :)
  16. CRDeveloper

    CRDeveloper Member

    Installing :)
    Cezz likes this.
  17. Cezz

    Cezz Well-Known Member

    I had, and there is probably many things I could do to improve this... However saying that the isBrowsingWith is only checking really for smart phones, IE Mobile Safari, Nokia, Symbian, Windows Mobile, Opera Mini & Blackberry (Wouldn't work for those using Firefox mobile or on older devices)... I wanted mine to be extendible, in fact the default user agents list in my mod includes kindle etc as well.
    James likes this.
  18. Anthony Parsons

    Anthony Parsons Well-Known Member

    I seriously hope to see this as part of XF in 1.1 to be perfectly honest... this is one really lacking area of XF at present... if not the only one of significance.

    Nice work Cezz....
    Cezz likes this.
  19. James

    James Well-Known Member

    I suppose you could've extended the isBrowsingWith function, but this method works fine so far :)
  20. Cezz

    Cezz Well-Known Member

    Valid point, didn't even think about it really... may look into doing that actually so that the extended list of mobile devises can be used by other mods also.
    James likes this.

Share This Page