c# Webbrowser control with frames
-
I am trying to change the "onload" event of the Body in a frame. My problem is when I using the GetAttribute method on the Body it returns "System._ComObject" as a string rather than the attributes value. Please note it is not returning an object of System._ComObject, just the string. I tried just doing the change via Body.OuterHtml but that throws an expception of NotSupportedException. Which is odd seeing as it is a property that says it allows "get and set" operations. WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload") = "System.__ComObject" Any ideas on how to get this to behave as it should would be greatly appreciated. Even just a point in maybe the right direction. Also I did try this using "mshtml" objects and all it got me was the actual System._ComObject. However, I had no idea how to covert that to the string it was supposed to actually represent.
-
I am trying to change the "onload" event of the Body in a frame. My problem is when I using the GetAttribute method on the Body it returns "System._ComObject" as a string rather than the attributes value. Please note it is not returning an object of System._ComObject, just the string. I tried just doing the change via Body.OuterHtml but that throws an expception of NotSupportedException. Which is odd seeing as it is a property that says it allows "get and set" operations. WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload") = "System.__ComObject" Any ideas on how to get this to behave as it should would be greatly appreciated. Even just a point in maybe the right direction. Also I did try this using "mshtml" objects and all it got me was the actual System._ComObject. However, I had no idea how to covert that to the string it was supposed to actually represent.
From a (very) quick google it seems that that is the expected behaviour. Some of the hits I got suggest using
WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").Name
//+++++++++++++++++
// OR
//+++++++++++++++++
WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").GetInterfaces()Although it seems that does not always work. In case you want to dig deeper I used c# system.__comobject as my search term. Nearly all the first page were about people having similar problems as yourself.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
From a (very) quick google it seems that that is the expected behaviour. Some of the hits I got suggest using
WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").Name
//+++++++++++++++++
// OR
//+++++++++++++++++
WebBrowser.Document.Window.Frames[i].Document.Body.GetAttribute("onload").GetInterfaces()Although it seems that does not always work. In case you want to dig deeper I used c# system.__comobject as my search term. Nearly all the first page were about people having similar problems as yourself.
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Thanks when I googled I must have been using the wrong search terms. I found a work around I just regexed the onload out of the body tag, then set the onload attribute the way I wanted it. Not the solution I wanted, but hey it works for what I needed. But doing it the right way will be more important when I start doing form fills on that page. I just wanted to keep this stupid popup alert that is in the body's onload event from activating.