Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: Invoke mobile skin on desktop

  1. #1
    jerm324 is offline Senior Member
    Join Date
    Oct 2009
    Posts
    122

    Default Invoke mobile skin on desktop

    Is there a way to invoke the mobile skin on my desktop for testing purposes?

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    You would have to change the browser's user agent to make the site think you were on a mobile device. Safari has an option for this built in, and Firefox has some addons that make it easy.

  3. #3
    kohenkatz is offline Junior Member
    Join Date
    Jul 2008
    Location
    Silver Spring, MD
    Posts
    23

    Default

    I know this is an old thread - but here is how I did it.

    In web\App_Code\SkinBase.cs, in the function GetTemplateName, right below
    Code:
    m_ismobile = HttpContext.Current.Request.Browser.IsMobileDevice || CheckUserAgentForMobile;
    , I added the following:
    Code:
    m_ismobile = IsMobileOverride(m_ismobile);
    .

    The function IsMobileOverride is the following:
    Code:
    public static bool IsMobileOverride(bool OriginalValue)
            {
                //Check for Query String
                if (CommonLogic.QueryStringBool("ShowMobile"))
                {
                    HttpContext.Current.Response.Cookies["ASPDNSF.IsMobile"].Value = "1";
                    HttpContext.Current.Response.Cookies["ASPDNSF.IsMobile"].Expires = DateTime.Now.AddDays(30);
                    return true;
                }
                //Check for Query String
                if (CommonLogic.QueryStringBool("LeaveMobile"))
                {
                    HttpContext.Current.Response.Cookies["ASPDNSF.IsMobile"].Value = "0";
                    HttpContext.Current.Response.Cookies["ASPDNSF.IsMobile"].Expires = DateTime.Now.AddDays(30);
                    return false;
                }
    
                //Check for cookie
                string cookieIsMobile = CommonLogic.CookieCanBeDangerousContent("ASPDNSF.IsMobile", false);
                if (cookieIsMobile.Length > 0) // Override is set
                {
                    return (cookieIsMobile == "1");
                }
    
                return OriginalValue;
            }
    I then use ?showmobile=1 and ?leavemobile=1 to switch to and from the mobile skin.

  4. #4
    mjg is offline Member
    Join Date
    Jan 2006
    Posts
    34

    Default

    Great tip, thanks!
    EMM - Enhanced Email Manager