Confluence "switch back to mobile" links does not appear when used in desktop mode

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

This article is about Confluence mobile web. It does not apply to the Confluence iOS app, which is available now for Confluence Cloud customers.

Problem

After switching to desktop mode in the mobile phone browser, the link "switch back to mobile" mode does not appear at the top menu. Therefore the user is not able to switch back to the mobile mode in their browser.

Workaround

The workaround is to manually add the link to switch back to mobile mode in your Confluence

  1. Go to Confluence Administrator >> Custom HTLM >> EDIT
  2. Add the following script in the header then save

     

     <script type="text/javascript">
       AJS.toInit(function() {
        Confluence.MobileSwitch = {
            
    
            switchToMobile: function(e) {
                AJS.$.cookie("confluence.mobile.desktop.switch", null, Confluence.MobileSwitch._cookieOptions); // this cookie name matches desktop-switch.js
                
                // remove the desktop=true request parameter if it is present
                if (window.location.href.match(/[?&;]desktop=true/)) {
                    var href = window.location.href.replace(/desktop=true&?/,"")
                    window.location = href;
                } else {
                    window.location.reload();                
                }            
            },
            
            initialise: function() {
    
                $messageContainer = AJS.$("#messageContainer");
    
                // If the element does not exist, it will be created.
                !$messageContainer.length && ($messageContainer = AJS.$("<ul id='messageContainer' />").appendTo("#header-precursor .cell"));
    
                $messageContainer.append(Confluence.Templates.Mobile.Switch.returnToMobileBanner());
    
                Confluence.MobileSwitch._cookieOptions = {
                    expires: 3650,
                    path: AJS.Meta.get("context-path") || "/",
                    raw: true
                };
    
                $messageContainer.find("a").click(Confluence.MobileSwitch.switchToMobile);
            }
        };
        
        Confluence.MobileSwitch.initialise();
    });
    </script>

Last modified on Feb 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.