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/frameworkdirectory and buildWPCordovaClassLib.sln. It creates theBin\Debug[Release]\WPCordovaClassLib.dll. -
Copy the
WPCordovaClassLib.dllfile into the Windows Phone 8 project's/libsdirectory and includeWPCordovaClassLib.dllto your project viaProject->References->Add Reference. Alternatively, you can directly reference thewp8/framework/WPCordovaClassLib.csprojfile. -
Add
CordovaViewcomponent 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.jsalong with the application's HTML and JavaScript files to the Windows Phone 8 project'shtmldirectory and include new files to the project. -
Copy the
wp8/template/config.xmlto 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.