How to View the Mobile Theme

 

uPortal4 decides to serve the desktop or mobile themes based on the User Agent string sent by the browser headers. All browsers allow you to switch your User Agent string to pretend to be a different browser. This is done either through built in debug tools (Safari, Chrome, IE) or through an addon (FireFox and Chrome). The User Agent is detected once and then stored in your session. You need to clear your cookies after changing the User Agent. Some browsers/tools reset the User Agent when they are restarted.

Changing userContext.xml

Alternately, you can edit userContext.xml to always serve the mobile theme regardless of User Agent. Add a new mapping that matches ".*" to "mobileDefault".

uportal-war/src/main/resources/properties/contexts/userContext.xml
    <bean class="org.jasig.portal.layout.UserAgentProfileMapper.Mapping">
        <property name="pattern" value=".*" />
        <property name="profileName" value="mobileDefault" />
    </bean>

There are a number of ways to edit this file to do this. The snippet above adds a mapping that will always match and set the profile to mobileDefault. This should be the first mapping.

Changing the User Agent

Changing the User Agent in Safari

  1. Click on the sprocket icon to open the Settings menu, then choose Preferences. 
  2. On the Advanced tab, tick the "Show Develop menu in menu bar" checkbox. 
  3. Then close the Preferences window.
  4. Next, click on the page icon to open the Current Page menu and choose Develop > User Agent. 
  5. Select a User Agent from the list.

Since the theme setting is saved in your session, you need to clear your cookies after you change the User Agent string:

  1. In Safari, go to Settings > Preferences > Privacy. 
  2. Under "Cookies and other website data" click on the "Details" button. 
  3. Search for your uPortal domain, select it from the list, and click the "Remove" button. 
  4. Then refresh the page.

Changing the User Agent in Chrome

  1. Click on the wrench icon to open the Settings menu, and choose Tools > Developer Tools. 
  2. Click on the sprocket icon at the bottom right of the Developer Tools window.
  3. Under "Network", tick the "Override User Agent" checkbox and then choose a User Agent string.

The uPortal theme is saved in your session, so you need to delete the session cookie:

  1. In the Developer Tools window, under the "Resources" tab, select your domain under "Cookies" on the left panel. 
  2. Then right click the JSESSIONID cookie and choose "Delete". 
  3. The refresh the page.

Changing the User Agent in FireFox

Changing the User Agent string in FireFox is tedious, so it is best to use an Add On. There are several available from the Get Add-ons tool in FireFox. (User Agent Switcher by Chris Pederick is a good one.)

After you change the User Agent, you need to clear your cookies because uPortal saves the theme selection in your session:

  1. From the navigation menu (you might have to press Alt to see it) choose Tools > Options. 
  2. Under the Privacy tab, click the "remove individual cookies" link. 
  3. Search for your domain name and remove the "JSESSIONID" cookie.

Changing the User Agent in Internet Explorer

  1. From the navigation menu (You might have to press Alt to see it) choose Tools > F12 Developer Tools. This will open the Developer Tools window. 
  2. From the Developer Tools window, choose Tools > change User Agent string, then choose the User Agent. 
  3. If a User Agent isn't listed, choose "Custom" to add one. (Refer to the list of Common Mobile User Agent Strings in the list below)
  4. Click the "Add" button, then choose the User Agent and click the "Set" button. 
  5. Restart the Browser to reset the User Agent string to default.
You need to clear your session cookies after you change the User Agent string:

  1. In the Developer Tools, choose Cache > clear session cookies to clear your session.

Common Mobile User Agent Strings

iPhone iOS 5
Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

iPhone iOS 4
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5

iPad iOS 5
Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

iPad iOS 4
Mozilla/5.0 (iPad; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5

Nexus S Android 2.3
Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

 

 

Having problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org

Add Feedback content box here.....