Awesomium 1.7.5.1,WinForms,网络控制obj.ExecuteJavascript
我想在现有的html代码中插入html代码。 但我看不到结果。这是代码C#: 1) Program.csAwesomium 1.7.5.1,WinForms,网络控制obj.ExecuteJavascript,winforms,awesomium,web-control,Winforms,Awesomium,Web Control,我想在现有的html代码中插入html代码。 但我看不到结果。这是代码C#: 1) Program.cs public partial class Form1 : Form { public Form1() { InitializeComponent(); wUI.DocumentReady += wUI_DocumentReady; } private void Form1_Load(object se
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
wUI.DocumentReady += wUI_DocumentReady;
}
private void Form1_Load(object sender, EventArgs e)
{
// code here ?
}
void wUI_DocumentReady(object sender, DocumentReadyEventArgs e)
{
wUI.LoadHTML("<html><body>sadasdsad</body></html>");
HtmlManager html = HtmlManager.Instance;
string[] placeholders = { "asset://customdatastore/path/to/any", "type-button", "no-action", "Example link" };
html.Add("<a href=\"{0}\" class=\"{1}\" id=\"{2}\">{3}</a>", placeholders);
html.InnerCode(html.Code, wUI, "body");
wUI.Refresh();
}
}
上升3:
与以下机构合作:
wUI.Source = new Uri(@"http://google.com");
在Form1\u Load中,您可以使用
LoadHtml
方法,但只有在文档完全加载后(不要与DocumentReadyState.Ready
混淆),它至少对我有效:
private void WebControl_DocumentReady(object sender, DocumentReadyEventArgs e)
{
if (e.ReadyState != DocumentReadyState.Loaded) return;
}
但是作为一种初始化,您应该使用
Source
属性,就像您在第三次更新中写的那样您可以使用LoadHtml
方法,但只有在文档完全加载后(不要与DocumentReadyState.Ready
混淆),它至少对我有效:
private void WebControl_DocumentReady(object sender, DocumentReadyEventArgs e)
{
if (e.ReadyState != DocumentReadyState.Loaded) return;
}
但是作为初始化,您应该使用
Source
属性,就像您在第三次更新中写的那样wUI.ExecuteJavascript(“document.getElementsByTagName('body')[0].innerHTML(\'sometext\”);当然了,伙计们。工作正常,请参见post.wUI.ExecuteJavascript(“document.getElementsByTagName('body')[0].innerHTML(\'sometext'))中的第3节;当然了,伙计们。工作正常,请参见post.wUI.ExecuteJavascript(“document.getElementsByTagName('body')[0].innerHTML(\'sometext'))中的第3节;当然了,伙计们。它成功了,请参见第3节。
wUI.Source = new Uri(@"http://google.com");
private void WebControl_DocumentReady(object sender, DocumentReadyEventArgs e)
{
if (e.ReadyState != DocumentReadyState.Loaded) return;
}