Sitecore: Test Local Instance on Mobile

All projects need to go through the development phase.When designing a website, one should make sure that the site is being rendered on a mobile phone properly. Many developers make use of the browser mobile agent plugins to see how the site will look like on a mobile. However, last time while debugging a code for mobile on a Sitecore Local Instance, I have seen that the layout being loaded is the desktop one and not the mobile one. This was on a local instance but the agent was working properly on our UAT server.

Testing on mobile phone should be performed as from the development stage. So, during this post, I will show you how you can configure the your Sitecore Local Instance to be used on Mobile phone.

First, you need to allow the port in the Inbound Rules. Go to

Control Panel -> Windows Firewall -> Advanced Settings

In the Inbound Rules, select New Rule. In the opened window, select

  1. Port
  2. TCP and specify the port
  3. Allow the connection
  4. The network Profile
  5. A name.

Now, the next step is to have a binding at IIS Level. Open the IIS manager and then your site, click on bindings and set the IP address of your machine. An example is shown below:

Bindings.PNG

If your device is connected to the same network, you can type in the IP address on your phone browser and it will open the site.

However, if you have many sites and needs to test for a specific one, you will require to create a Site Definition for that site. An example of the Site Definition for the mobile is shown below:

 <site name="mysecondsite" patch:before="site[@name='website']"
    virtualFolder="/"
    hostName="192.168.100.17"
    physicalFolder="/"
    rootPath="/sitecore/content/Sites"
    startItem="/mySecondSite"
    database="web"
    domain="extranet"
    allowDebug="true"
    cacheHtml="true"
    htmlCacheSize="50MB"
    enablePreview="true"
    enableWebEdit="true"
    enableDebugger="true"
    disableClientData="false"/>

The main important attribute here is the hostName where you need to specify the IP Address in it. By changing the rootPath and startItem attributes, you can easily swap between different sites on mobile locally.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s