c# - C# Xaml WebBrowser.DocumentText Youtube 错误
问题描述
我有问题WebBrowser.DocumentText
我收到此错误:
WebBrowser 不包含“DocumentText”的定义,并且找不到接受“WebBrowser”类型的第一个参数的可访问扩展方法“DocumentText”(您是否缺少 using 指令或程序集引用?
代码 :
string _yUrl;
public string VideoID
{
get
{
var yMatch = new Regex(@"http(?:s?)://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)([\w\-]+)(&(amp;)?[\w\?=]*)?").Match(_yUrl);
return yMatch.Success ? yMatch.Groups[1].Value : string.Empty;
}
}
private void btnGo_Click(object sender, EventArgs e)
{
_yUrl = https://www.youtube.com/watch?v=cZ1Z0zZHktI;
webBrowser.DocumentText = String.Format("<meta http-equiv='X-UA-Compatible' content='IE=Edge'/><iframe width='100%' height='315'" +
" src='https://www.youtube.com/embed/{0}?autoplay=0' frameborder='0' allow='accelerometer;" +
" encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>", VideoID);
}
解决方案
推荐阅读
- javascript - 如何过滤数组并添加到新数组
- angular - 如何隐藏但不禁用按钮?与“[隐藏] =“隐藏按钮[item.product_id]”
- php - 如何更改 Laravel 中嵌套资源路由的名称?
- windows - 用于拆分文件夹中所有文件的 PDFTK 脚本 - noob
- teradata - SQOOP 在导入数据时如何检测驱动类?
- ruby-on-rails - Rails 茧:提交表单后嵌套字段消失
- python - 在带有子图的 geopandas 图中添加图例会改变图的大小
- pyqt - 如何更改 QTableView 的一组行的颜色?
- r - 如何根据 r 中的条件为行分配新值?
- amazon-web-services - 用于 ElasticSearch 服务的简单 AWS AppSync 架构和解析器