2

I created a responsive SharePoint site that works well for both Desktop and Mobile versions.

The problem is that SharePoint automatically redirects mobile devices to the "Mobile" URL, which is something like:

http://mysite/_layouts/mobile/mbllists.aspx

I know that it's possible to disable this in Farm solutions, but does anyone know how to do this in SharePoint Online?

If not possible, is there a workaround for this?

Thanks

5

I finally wrote a script that appends "mobile=0" to all links relative to the site collection.

function fixMobileLinks {
    var qMobile = $().SPServices.SPGetQueryString()["mobile"];
    if (qMobile == "0") {
        var siteCollectionUrl = "http://mySiteCol";
        var jLink = 'a[href*="' + siteCollectionUrl + '"]';

        $("#s4-workspace").on("click", jLink, function () {
            var $link = $(this);                
            var href = $link.attr('href');
            href = updateQueryStringParameter(href, "mobile", "0");
            location.href = href;
            return false;           
        });
    }
}

function updateQueryStringParameter(uri, key, value) {
    var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
    separator = uri.indexOf('?') !== -1 ? "&" : "?";
    if (uri.match(re)) {
        return uri.replace(re, '$1' + key + "=" + value + '$2');
    }
    else {
        return uri + separator + key + "=" + value;
    }
}
2

The only answer I can find is:

To achieve the goal, please change “?mobile=1” to “?mobile=0” at the end the URL on mobile device. For example, to access the default homepage of a SharePoint public website without mobile version, please change “....com/Pages/default.aspx?mobile=1” to “....com/Pages/default.aspx?mobile=0”

Source: http://community.office365.com/en-us/forums/154/p/13897/63610.aspx#63610

Now if there is anyone WHO can make a script that is loaded on the page that changes the "1" to a "0", or figure out another solution, that would help a lot.

/Ulrich

  • Yes, I finally had to write that script, thanks for the update. I'll post the solution here. – Amadeo Gallardo Mar 21 '13 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.