Edward_jie

for you, my Hall of Frame

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

use webbrowser in windows phone 7

是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:

 

posted on 2011-12-02 17:28  Edward_诺  阅读(284)  评论(0)    收藏  举报