想在WP7的外部浏览器中打开链接 [英] want to open Link in external browser of WP7

查看:145
本文介绍了想在WP7的外部浏览器中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该架构是这样的:结果
在点击一个按钮的HTML页面打开其中包含一个链接。在单击的链接我想在WP7使得应用程序关闭和链接打开外部的外部(默认)浏览器中打开它。我怎样才能实现呢?结果
添加了这个控制XAML文件:

The architecture is like:
On click of a button an HTML page opens which contains a link in it. On clicking the links I want to open it in external (default) browser of WP7 such that the application closes and link opens externally. How can I implement this?
Added this control in xaml file:

<phone:WebBrowser Name="browser" Margin="0,78,0,0" />

在按钮点击:

   private void Information_Loaded(Object sender,RoutedEventArgs e)
   {
       Assembly assembly = Assembly.GetExecutingAssembly();

       using (Stream stream = assembly.GetManifestResourceStream("index_en.html"))
       {
           using (StreamReader reader = new StreamReader(stream))
           {
               string html = reader.ReadToEnd();

               browser.NavigateToString(html);                   
           }
       }

现在index_en.html有一个链接这是在外部浏览器中打开。

Now index_en.html has a link which is to be opened in external browser.

推荐答案

您可以使用 WebBrowserTask 来启动浏览器。

You can use the WebBrowserTask to launch the browser.

我发现,你需要逃避您传递给它虽然网址:(

I've found that you need to escape the URL you pass to it though :(

这篇关于想在WP7的外部浏览器中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆