Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

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;
    }
}
share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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