WebBrowser control for Windows Phone 8
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Windows Phone provides a WebBrowser control that is based on the desktop browser. The WebBrowser control for Windows Phone OS 7.1 is based on Internet Explorer 9, and the WebBrowser control for Windows Phone 8 is based on Internet Explorer 10. Because of this, there are slight differences in the appearance of apps that use the WebBrowser control running on Windows Phone 7.5 compared to phones that run on Windows Phone 8.
The WebBrowser control can be embedded in an app and used for a number of purposes that include, but are not limited to, the following:
Displaying web content from the network. You can build an app that’s composed solely of an embedded WebBrowser control that points to your website, with custom branding around the outside of the control. For more info, see How to display web content from the network using the WebBrowser control for Windows Phone 8.
Displaying static web content. You can configure an app to save content locally in isolated storage, and then the user can view it later in an embedded WebBrowser control. For more info, see How to display static web content using the WebBrowser control for Windows Phone 8.
Displaying dynamically generated web content. You can point the WebBrowser control at HTML content that’s constructed dynamically in the app code. For more info, see How to display dynamically generated web content using the WebBrowser control for Windows Phone 8.
Script is disabled in the WebBrowser control by default. Set the IsScriptEnabled property to true if you want to enable scripting in your control. You can then call scripts using the InvokeScript method. The ScriptNotify event occurs when JavaScript in the WebBrowser control passes a string to managed code.
Warning
When you create a WebBrowser control in XAML, you must specify a value for the P:System.Windows.FrameworkElement.Name property for that control so that the Windows Phone Capability Detection Tool can properly detect and grant the right capabilities for your app. For more info about the Windows Phone Capability Detection Tool, see How to determine app capabilities for Windows Phone 8.
You can also use the GetCookies(WebBrowser) method of the WebBrowserExtensions class to retrieve a collection of cookies from a website that you can use in future web requests. For more info about working with cookies, see How to get and set cookies for Windows Phone 8.
Sample app
To view a sample app that uses the WebBrowser control, see How to create your first app for Windows Phone 8.