我怎样才能在WebBrowser控件的页面标题? [英] How can I get the page title in WebBrowser control?

查看:537
本文介绍了我怎样才能在WebBrowser控件的页面标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能在一个WebBrowser控件的网页标题,当我浏览到不同的网站?


的xmlns

 的xmlns:手机=CLR的命名空间:Microsoft.P​​hone.Controls;装配= Microsoft.P​​hone

以D开头的属性

 的DataContext
DesiredSize
调度员
双击

XAML标记

 <电话:web浏览器名称=浏览器HEIGHT =760VerticalAlignment =评出的>< /电话:web浏览器>


解决方案

我有同样的问题。 @Akash卡瓦的答案几乎是正确的,但,这是正确的JavaScript来阅读HTML标题:

 字符串标题=(字符串)browser.InvokeScript(EVAL,document.title.toString());

How can I get the page title in a WebBrowser control when I navigate to different websites?


xmlns

xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

Properties starting with D

DataContext
DesiredSize
Dispatcher
DoubleTap

xaml tag

<phone:WebBrowser Name="browser" Height="760" VerticalAlignment="Top"></phone:WebBrowser>

解决方案

I had the same problem. @Akash Kava's answer is almost correct but this is the correct javascript to read the html title:

String title = (string)browser.InvokeScript("eval", "document.title.toString()");

这篇关于我怎样才能在WebBrowser控件的页面标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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