The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MObile v Full Interface

Discussion in 'cPanel Developers' started by PCZero, Sep 9, 2012.

  1. PCZero

    PCZero Well-Known Member

    Joined:
    Dec 13, 2003
    Messages:
    526
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    Earth
    I asked this in another part of the forums and got no answer, maybe I asked in the wrong place so I am going to try here. I hope this is not in violation of the rules.

    I need to find where it is that the code determines if a user logging in to cPanel is mobile and thus is fed the mobile v the full cPanel interface. Can someone point me in the right direction please?
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I believe the code is in the cpsrvd and cpanel binaries. What are you attempting to accomplish?
     
  3. PCZero

    PCZero Well-Known Member

    Joined:
    Dec 13, 2003
    Messages:
    526
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    Earth
    Well it is moreso for knowledge than anything else. I want to see what parameters are being tested to determine which layout is presented and decide if I might want to modify those parameters. Also I am going to start developing mobile versions of some of my clients' web sites. As such, learning how cPanel makes this determination may help me do the same for my clients' sites.
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,478
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    User agent in most cases I believe. For example, install this Firefox addon:
    /https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/

    Set it to iPhone, and visit your cPanel. You'll be sent to the Mobile style.

    HTH :)
     
  5. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    As infopro mentions, I believe it is the UserAgent string. While the code used is compiled into binaries, I just realized there is a readable form in /usr/local/cpanel/Cpanel/MobileAgent.pm

    In 11.32, the following regular expression is used to determine whether a UserAgent is mobile:

    Code:
    /HTC_|Android|AU-MIC|AUDIOVOX-|Alcatel-|AnexTek|AvantGo|BlackBerry|Blazer|CDM-|Dopod-|Ericsson|HPiPAQ-|HTC-|Hitachi-|KDDI|LG|MM-|MO01|MOT-|MobilePhone|Motorola|N515i|N525i|NEC-|NOKIA|Nokia|OPWV|Opera mini|PG-|PLS|PM-|PN-|Palm|Panasonic|Pantec|QCI-|RL-|SAGEM|SAMSUNG|SCH|SCP-|SEC-|SGH-|SHARP-|SIE-|SPH|SPV|Samsung|Sendo|Smartphone|SonyEricsson|UP.Browser|UP.Link|V60t|VI600|VK530|VM4050|Vodafone|Windows CE|amoi|hiptop|portalmmm|mobile|Mobile|phone|iPhone/
    
    Also, we do an additional check to remove iPad from the matching (since iPads have larger screens and can handle the full interface we don't treat it as a mobile device).
     
  6. PCZero

    PCZero Well-Known Member

    Joined:
    Dec 13, 2003
    Messages:
    526
    Likes Received:
    34
    Trophy Points:
    28
    Location:
    Earth
    Kenneth thank you very much for that. Info pro thanks to you as well. Between you I will be able to grab what I need. That looks great. Very much appreciated...
     
Loading...

Share This Page