Windows Phone 8.0 WebViews
This guide shows how to embed a Cordova-enabled WebView component within a larger Windows Phone 8.0 application.
To follow these instructions, make sure you have the latest Cordova distribution. Download it from cordova.apache.org and unzip its Windows Phone 8.0 package (cordova-wp8-*.zip).
-
Navigate to the package's
wp8/framework
directory and buildWPCordovaClassLib.sln
. It creates theBin\Debug[Release]\WPCordovaClassLib.dll
. -
Copy the
WPCordovaClassLib.dll
file into the Windows Phone 8 project's/libs
directory and includeWPCordovaClassLib.dll
to your project viaProject->References->Add Reference
. Alternatively, you can directly reference thewp8/framework/WPCordovaClassLib.csproj
file. -
Add
CordovaView
component to your page (for example,MainPage.xaml
).xmlns:my="clr-namespace:WPCordovaClassLib;assembly=WPCordovaClassLib"> ... <my:CordovaView HorizontalAlignment="Stretch" Margin="0,0,0,0" StartPageUri="html/index.html" x:Name="CordovaView" VerticalAlignment="Stretch" />
-
Copy
common/www/cordova.js
along with the application's HTML and JavaScript files to the Windows Phone 8 project'shtml
directory and include new files to the project. -
Copy the
wp8/template/config.xml
to the project's root directory and
Instructions above will link core Cordova components only, see Using Plugman to Manage Plugins in order to link Cordova plugins.