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.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

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.