qwert Posted April 23, 2017 Share Posted April 23, 2017 (edited) I have an embedded IE object that works fine, when using _IENavigate to display content. But there are times when I need to clear the content pending the result of other entries or actions. I've tried navigating to "empty content" by using "" as the URL. But I get the standard page failed display. Is there a way to temporarily clear (blank out) the displayed content? Thanks in advance for any help. Edited April 24, 2017 by qwert Link to comment Share on other sites More sharing options...
qwert Posted April 24, 2017 Author Share Posted April 24, 2017 On another site, I found a method that seems to work. If there's a better way, please chime in. Link to comment Share on other sites More sharing options...
genius257 Posted April 24, 2017 Share Posted April 24, 2017 Hi @qwert. navigating to "about:blank" is one way, you can also do: _IEDocWriteHTML($oIE, "") but doing this does not remove event listeners from the page (like the document events). Finally you can use HTML in your navigation address, but when i worked with it, it only works in the embedded version: "about:<!DOCTYPE html><html></html>" I find the above helpful, as "about:blank" already uses a doctype and i have had little success in changing it, seeing small weird CSS and HTML things that just are a pain in the ass. My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
qwert Posted April 24, 2017 Author Share Posted April 24, 2017 (edited) Thanks for your response. I've confirmed that both of the "about" methods work. But I get a consistent failure when trying the WriteHTML method: Quote "C:\AutoIt3\Include\IE.au3" (1654) : ==> The requested action with this object has failed.: $oObject.document.Write($sHTML) $oObject.document^ ERROR Nonetheless, the "about:blank" method works better in the context of my particular script. Yet it's good to know there are other possibilities for placing content in the object. For now, I'll consider this Solved. Footnote: for the record, I found an example that implies that you must first navigate to the object, and then write any html. A quick test confirmed that using those two statements does not cause a fail. This should make it practical to insert text like "Please wait ..." into the object. I tried the method with the following lines. It does work. $sHTML = "<html><body>Hello world</body></html>" _IENavigate ($oIE2, "About:Blank") _IEDocWriteHTML($oIE2, $sHTML) Edited April 24, 2017 by qwert Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now