WebBrowserTask Windows Phone Launcher to Open Web Browser and Display URL
Programmers use WebBrowserTask to launch Internet Explorer web browser within a Windows Phone 8 app to open external web URL.
This Windows Phone 8 app development tutorial shows how to open web browser in Windows Phone 8 app using WebBrowserTask Windows Phone 8 Launcher in Microsoft.Phone.Tasks namespace.
For example you deal with Windows Phone 8 app development and you want to open your homepage using HyperlinkButton control on the WP8 app Help or About page.
Then using Microsoft.Phone.Tasks namespace, among Windows Phone 8 Launcher WebBrowserTask can be used to launch Internet Explorer 10 web browser and display the web address (URL) you specify in your app code.
HyperlinkButton and WebBrowserTask in Windows Phone 8 App Development
While I was preparing About page for my Windows Phone 8 app Lights Out game, I need to open the online Lights Out game page on WP8 default web browser, Internet Explorer 10.
I designed following layout for About page of the sample Windows Phone 8 game app. You will see the HyperlinkButton control with link text set to "http://www.kodyaz.com"
HyperlinkButton control and WebBrowserTask is used to launch Web Browser (Internet Explorer 10 on Windows Phone 8) and display external web address or URL
The easiest way to open a web page on web browser is using WebBrowserTask among Windows Phone Launchers.
In the Click event of the HyperlinkButton we can create code to handle a Windows Phone 8 launcher to open Internet Explorer web browser and navigate to URL address that we will define.
Before using WebBrowserTask we have to include the Microsoft.Phone.Tasks namespace into our code.
Now we are ready to code to create a web browser task instance and specify a URL address for this task using its URI property.
Then we will start the task by calling the SHOW method.
Here is a sample VB.NET code
Dim webBrowserTask as WebBrowserTask = new WebBrowserTask()
webBrowserTask.Uri = new Uri("http://www.kodyaz.com", UriKind.Absolute)
Of course Windows Phone app developers can also use a Web Browser component and display the desired web address in this component.
Using WebBrowser component is also an answer for how to open a web browser from a Windows Phone app.
But this will not launch Internet Explorer web browser as an external application. And if you use Web Browser component instead of WebBrowserTask Windows Phone 8 Launcher, the web pages will be a part of your application navigation.
Use WebBrowserTask for external references in your Windows Phone 8 app development projects.
Besides WebBrowserTask Windows Phone Launcher, in your Windows Phone 8 app development there are other launchers like EmailComposeTask to send email and SmsComposeTask to send SMS within an app, ShareLinkTask to share a link (for example your Windows Phone 8 app link) on social media sites.