Hi All,
My application is using DesignMode feature on Webbrowser control. I'm getting my application to support IE11.
We normally preper some date when the page is loaded accroding different users, and use SetAttribute to set the value. That works fine on IE10 and before.
Starts from IE11, I find the SetAttribute will create a Undo action which User can reverte my hard code action by using undo/redo feature.
To reproduce this issue, we call create a general winform application and drop a webbrowser control on it,
private void Form1_Load(object sender, EventArgs e) { webBrowser1.DocumentText = "<html><body><input/></body></html>"; webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted); } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { IHTMLDocument2 doc = webBrowser1.Document.DomDocument as IHTMLDocument2; var undoresult = doc.queryCommandEnabled("Undo"); foreach (IHTMLElement ele in doc.body.children) { ele.setAttribute("value", "<@>", 0); } var undoresult2 = doc.queryCommandEnabled("Undo"); MessageBox.Show(String.Format("before setvalue Undo is {0}, after is {1}",undoresult,undoresult2)); }
When we run the code with IE9/10, both Undo states are false. However, in IE11, after call setAttribute, the Undo becomes true, and we can call execute undo to revert the set action, which is unexpected.
Is this a bug on IE11? Any workaround to make Undo works as before?
Regards,
Yi
MSC on Computer Science (Parallel algorithm)