是phone7中的瀏覽器控制項,它是基於Internet Explorer7的,可以直接嵌入到應用程式中。這個控制項相對於Windows mobile也有了許多的不同。另外這個控制項與MediaElement 一樣,只是一個基本顯示視窗,所有的控制都需要自已來完成。如Forward、Backward、Refresh等。
<phone:WebBrowser Grid.Row="1" HorizontalAlignment="Left" Name="webBrowser1" VerticalAlignment="Top" Height="649" Width="480" Source="http://www.baidu.com" IsScriptEnabled="False"/>
Source:要載入的HTML頁。
IsScriptEnabled:是否運行頁面指令碼。預設為不可用。
該控制項可以完成以下功能:
動態載入HTML內容:
webBrowser1.NavigateToString("<html><head><meta name='viewport' content='width=480, user-scalable=yes' /></head><body>HTML Text</body></html>");
載入靜態HTML頁面或Isolate Storage上的HTML頁面:
webBrowser1.Navigate(new Uri("readme.htm", UriKind.Relative));
載入網路上的Web頁面:
webBrowser1.Source = new Uri("http://www.baidu.com", UriKind.Absolute);
另外,這個控制項還支援.xhtml的瀏覽。
如:webBrowser1.Navigate(new Uri("http://www.flashkit.com/index.xhtml", UriKind.Absolute));
但是該控制項也有一些無法完成的功能:
無法瀏覽https頁面;
無法顯示加密表徵圖;
不支援Plug-ins。
如:webBrowser1.Navigate(new Uri("https://ibsbjstar.ccb.com.cn/V5/index.html", UriKind.Absolute));
Phone7與silverlight還是有一定的區別的,以下是對比表:
Phone7上擴充的Javascript function: