Navigate Up
Sign In
Supporters of Developer
Web

How we did it - Mobile View

Item is currently unrated. Press SHIFT+ENTER to rate this item.1 star selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+ESCAPE to leave rating submit mode.2 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.3 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.4 stars selected. Press SHIFT+ENTER to submit. Press TAB to increase rating. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.5 stars selected. Press SHIFT+ENTER to submit. Press SHIFT+TAB to decrease rating. Press SHIFT+ESCAPE to leave rating submit mode.

​By default on a Site Collection using the Publishing Site with Workflow Template, when browsing on an iPhone etc. the Mobile View will be used.

IMG_0438.JPG
As you can see from the picture above, the view is pretty useless with a list of Lists such as "Workflow Tasks" and "Customized Reports" that mean nothing to an anonymous user!

Now, by default the Lockdown Feature is enabled which prevents anonymous users from viewing pages in the '/_layouts/' folder which is where the Mobile View page lives (​ /_layouts/mobile/mblwp.aspx) ...brilliant! So any iPhone users to this site before today would get an authentication prompt and our IIS logs were full of 401 errors for this page ;-)

IMG_0437.JPG

There are a few approaches to switching the iPhone view to just use the same view as what a normal browser would see...most mobile browsers are good enough to render these pages properly.

Option 1 - Modify the compat.broswer file

Creadit to Randy Drisgill for this one where he demonstrates this solution. Essentially you override the:


<capability name="isMobileDevice"                    value="true" />

 for each device in the file located at your Web Application system file location e.g.  
C:\inetpub\wwwroot\wss\VirtualDirectories\nbsp80\App_Browsers\compat.browse.
To:

<capability name="isMobileDevice"                    value="false" />

For each device in the file. I actually tried this and did a find replace on all.
 

 Option 2 - Modify the web.config file

Kudos to Koen Zomers for this fix in the web.config file. Simply add this block in the 'configuration/system.web' child elements:


 <browserCaps>
  <result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  <filter>isMobileDevice=false</filter>
</browserCaps>

 


Koen worked this out after using Reflector on the SharePoint assemblies. This allows you to simply switch it off in one place without touching the compat.browse files.

Option 3 - Switch off Lockdown

I would strongly recommend against using this approach on an Internet Facing SharePoint web site as it'll mean anonomous users have access to all '/_layouts/' files such as viewlsts.aspx etc. which can be dangerous.

And the finished result on an iPhone which works fine with the scroll bar. Interestingly the iPad didn't use mobile view in first place, and never work because trying to scroll down the page doesn't work *sigh*

photo.PNG

Thanks to the MSDN Forums for a great discussion on this. There is a little bit on MSDN on this to date.

 

Categories: Mobile

Comments

Tobias Traguth

Scrolling on iPad

Nice Article! Try scrolling with 2 fingers...works smoothly :) Keep the good work up - greeting to Mark from Germany. Tobias

Posted 04-Jan-2011 by Tobias Traguth
Jeremy Thake

RE: Scrolling on iPad

Tobias, that's a great tip about double finger scrolling! Works like a charm, suddenly can make our bug request a lower priority ;-)

Posted 04-Jan-2011 by Jeremy Thake
Dipti Chhatrapati

Not Working

Hello , Thanks for this solution , i have tried out , but yet my site is redirecting to mobile pages :( , what could be the problem ? could you please let me know !!! Thanks & Regards, Dipti Chhatrapati

Posted 13-Jan-2011 by Dipti Chhatrapati
Jeremy Thake

RE: Not Working

What solution did you try out? What mobile device are you using?

Posted 13-Jan-2011 by Jeremy Thake
Dipti Chhatrapati

Not giving result in mobile

Hi , Thanks for your kind reply !! i m trying on i phone as well as on browser too by appending mobile=1 in URL ..and moreover i have set all IsmobileDevice="False" properties in compat.browse file . i followed these steps on two sites too. 1) local 2) live , but yet result is same !!!! Would u please help me out for that. Thanks & Regards, Dipti Chhatrapati

Posted 16-Jan-2011 by Dipti Chhatrapati
i:0e.t|liveid|00037ffe966699cb@live.com

It works now :)

Hii Jeremy Thake , Its wrking like a charm in iphone !!! Thanks a lott for your superb efforts !!!

It works now :)

Hii Jeremy Thake , Its wrking like a charm in iphone !!! Thanks a lott for your superb efforts !!!

Posted 17-Jan-2011 by

It works now :)

Hii Jeremy Thake , Its wrking like a charm in iphone !!! Thanks a lott for your superb efforts !!!

Posted 17-Jan-2011 by
Laurent Schoenaers

Not working either

Hi, I tried all 3 solutions, but I'm still getting redirect to the mobile page. I'm really pulling my hair out on this one. Any ideas what might cause this? I'm running SharePoint Server Enterprise. Kind regards, Laurent Schoenaers

Posted 18-Jan-2011 by Laurent Schoenaers
DeafDJ

Scrolls behave strange when you flip iPhone horizontal to vertical

Hi,
First of all thanks for this great article.
When I navigate to our sp2010 public website via iPhone, the scrolls behave strange, especially if the page does not fit on the screeen. You may reproduce the error by flipping your iPhone vertical to horizontal state.
 
Thanks again... 

Posted 27-Jan-2011 by DeafDJ
altaf

not working Android phones

It worked on iPhone but not work on Android phones please help me

Posted 23-Mar-2011 by altaf
Susan

Hosted Solution

What about a solution for sites in a hosted environment w/o access to server-side? Is there any method that could be used via the master pages and/or some javascript to accomplish the same end - i.e. no mobie view?
 
We have a public-facing site, but are using shared hosting with FPWeb, so there's no ability to access compat.browser or deploy an HTTP Module. Any ideas?

Posted 26-Apr-2011 by Susan
suraj

Works for Anroid and iPhone

Thanks. It worked nicely for me

Posted 13-Jun-2011 by suraj
Manish

redirection to a different website

Hi, It is a nice article. Thanks. However, I will appreciate if somebody can point me in the right direction as my needs are a bit different. We have a sharepoint website, and we are developing a mobile site separately and want to redirect to that mobile WAP site (hosted separately with no link/connection to sharepoint website) when a user connects from a mobile device. Most of the articles that I have seen are moving to a different page and that too only for Home Page Redirection scenario. What is the best approach to do such kind of redirection? Is there a feature in Sharpoint that can accomplish it with minimal changes or it has to be a custom code? Thank you, Manish

Posted 02-Aug-2011 by Manish
Rich Finn

Cracked

How come there are no comments about the broken iPhone? Here's one ;) Rich

Posted 24-Oct-2011 by Rich Finn

Notify me of comments to this article

E-mail:
   

Add Comment

Title:

 
Comment:
Email:

   


Name:

 
Url: