简体   繁体   English

Win8 / Metro:WebView控件中的网址和文档?

[英]Win8/Metro: Url and Document in WebView control?

I am creating a metro-style version for one of my apps, coded in c#. 我正在为我的一个应用程序创建一个Metro风格的版本,使用C#编码。 I need to access a web page, get the url and html code from that page and then use them. 我需要访问一个网页,从该页面获取url和html代码,然后使用它们。

In the winforms version, i used a WebBrowser control and its properties, .Url and .Document.ActiveElement.OuterHtml/InnerHtml. 在winforms版本中,我使用了WebBrowser控件及其属性.Url和.Document.ActiveElement.OuterHtml / InnerHtml。

For the metro-style app, i used a WebView control to access the page but it doesn't have such properties and i can't find anywhere how to get the url and the html code. 对于Metro风格的应用程序,我使用了WebView控件来访问页面,但它没有此类属性,而且我在任何地方都找不到如何获取url和html代码的方法。

Anybody knows how to do that? 有人知道该怎么做吗? Thanks in advance! 提前致谢!

Edit: something like this (winforms, C#): 编辑:像这样的东西(winforms,C#):

webBrowser1.DocumentCompleted+=delegate
{
    if (webBrowser1.Url.ToString ().StartsWith ("http://www.google.com/"))
    {
        string url=webBrowser1.Url.ToString ();
        string htmlCode=webBrowser1.Document.ActiveElement.InnerHtml;
    }
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM