Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Pocket PC Simulated Resizable Browser

0.00/5 (No votes)
18 Jan 2008 1  
A mini browser for PDA web developers.

Pocket PC Browser

Introduction

Developing a web page for PDAs often requires special consideration on user experience because the PDA screen is substantially smaller than those in other development environments. Developers usually re-size the desktop browser to approximately the size of the PDA browser for debugging and testing. While this is OK, the developer experience and user experience are not the same. This Pocket PC Simulated Browser intends to close the gap between developer experience and user experience. It is not an emulator. It is just a browser allowing developers to have a better experience of their final product.

New Feature in Version 3

In the first two versions, you cannot alter the size of this browser. However, in real life, not all PDA and PDA phones have the same browser size. So, I included a resizable browser in this version.

Using the Code

This is a Windows Forms project. I mostly rely on Visual Studio 2005's built-in WebBrowser control for development. All of the code is quite straight-forward and are self-explanatory. Please feel free to download the source code to find out more about the programming logic.

I also included an installer. You can install the browser to your PC without understanding the internal mechanism. The pre-requisite is to have .NET Framework 2.0 installed on your Operating System. After installing the program, you can use it as a mini browser.

However, the purpose of this project is to facilitate developers to use it during development. We, therefore, need to link it up to Visual Studio 2005.

Linking the Brower to Visual Studio

After installing this browser, you can open a web application in Visual Studio 2005. On the Solution Explorer, right-click the web page that you want to use this browser with and select "Browse With..". You can see the following dialog box for adding any browser:

Points of Interest

Unlike C#, VB.NET starts a Windows Application from Windows Forms directly. While this is very convenient, it cannot provide the opportunity for you to pass in external parameters or arguments. In this project, I need to link it to Visual Studio 2005. Visual Studio 2005 will pass the web page of the development server to the browser for debugging. So, I need to tweak the start-up of this project with the following code:

Module Module1

    Friend strHomeUrl As String = ""
    Sub Main()
      Dim arrArgs() As String = Command.Split(",")

      If arrArgs(0) <> Nothing Then
        strHomeUrl = arrArgs(0)
      End If

      Application.Run(New Form1)

    End Sub

End Module

As soon as Form1 is loaded, it can call strHomeUrl in its load event. However, the string passed from Visual Studio 2005 is bracketed by a pair of quotation marks. These quotation marks must be removed by the program so that strHomeUrl can become a valid URL.

History

  • Project was posted at CodeProject in May 2007.
  • Project updated in June 2007 with better Favorite support.
  • Project updated in September 2007, added a resizable feature.
  • Source code of version 3 added upon readers' request.
  • In December 2007, added a web-based version. It can be found in http://www.codeproject.com/KB/webforms/pbc1.aspx.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here