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

查看:30
本文介绍了想在 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.

我发现您需要转义传递给它的 URL :(

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

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

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