-->

How to customize SharePoint 2010 mobile view

2019-06-17 02:49发布

问题:

I am stuck on developing a mobile view for my SP2010 publishing portal. It is Internet-facing with custom pages / web parts (e.g. http://server/Pages/customPage.aspx with custom webparts on it). The site has a custom master page.

I am having the following issues with the built-in mobile functionality:

  1. The welcome page. Navigating to http://server/?Mobile=1 redirects me to http://server/_layouts/mobile/mbllists.aspx, which just shows a table of lists / document libraries available. For my portal, I want to show a dashboard, just like I currently do for the "normal" non-mobile view.

  2. Navigating to one of my custom pages (e.g. http://server/Pages/customPage.aspx?Mobile=1) also redirects to http://server/_layouts/mobile/mbllists.aspx.

So in effect there is really no helpful built-in mobile support at all; just the ability to view lists with a mobile device.


So I have a number of issues and I'm hoping for some high-level help. My thought is that I should do the following tasks:

  1. Create a separate master page for mobile
  2. Figure out how to choose this master page based on "is client a mobile device?"
  3. Figure out how to prevent the redirection to /_layouts/mobile/mbllists.aspx

Then I think the mobile site will operate similarly to the normal site.

Am I on the right track?


[Edit]

With what I have seen from links from @moontear and other research I've done, it sounds like my best option is to just disable built-in SharePoint mobile support, and just do my own conditional rendering based off of Request.Browser.IsMobileDevice.

回答1:

Check out the extensive MSDN documentation about how to customize Mobile Views:

  • How to: Customize Mobile List View and Form Pages

when you check out that page you can see that you can already change the layouts of the list forms and maybe that is enough for you - but as you said you want a custom "Dashboard", you probably want to look into how the mobile redirection works:

  • Overview of Mobile Pages and the Redirection System

You can set which device is treated as mobile device by editing the compat.browse file as explained in this post: SP2010 Branding Tip #6 – Mobile Browsers, this way the device you set is shown your regular Sharepoint page (answering your questions 2/3).



回答2:

Copy the "_layouts/mobile" folder to e.g. "_layouts/MyCompany/mobile", in webconfig add following appSetting key:

<add key="mobile_applicationrootdirectory" value="_layouts/MyCompany/mobile/"/>

After that you can add branding, css, etc. to your own mobile folder. SharePoint is using this by calling SPMobileUtility.GetAppRootDirName() http://msdn.microsoft.com/en-us/library/ee553908(v=office.14).aspx



回答3:

using powershell

 Disable-SPFeature -Identity MBrowserRedirect -Url http://url