简体   繁体   English

禁用“此文档已被修改”消息

[英]disable “this document has been modified”-message

I am changing the content on my webbrowser control using 2 different methods. 我正在使用2种不同的方法来更改Web浏览器控件上的内容。 I am only able to disable the message in one situation. 我只能在一种情况下禁用该消息。
method 1: 方法1:
I just need to add some text at the bottom of the page (i don't get the message) 我只需要在页面底部添加一些文本(我没有收到消息)

string s = browser.DocumentText + "<a>Extra Text</a>";
browser.Document.Write(string.Empty);  
browser.DocumentText=s;

method 2: 方法2:
When i try to create a new element and add it to the webbrowser I still get the "this document has been modified"-message. 当我尝试创建一个新元素并将其添加到Web浏览器时,我仍然收到“此文档已被修改”的消息。 Can i disable this message? 我可以禁用此消息吗?

HtmlElement element = browser.Document.GetElementById("myId");
HtmlElement newElement = browser.Document.CreateElement("a");
newElement.InnerText = "Extra text";
element.AppendChild(newElement);

尝试

myWebBrowser.Document.ExecCommand("Refresh", False, "")

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

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