Note that there are some explanatory texts on larger screens.

plurals
  1. POManually Writing the HTML in TWebBrowser Pt. 2
    primarykey
    data
    text
    <p>As the name suggests this is a continuation (sort of) of <a href="https://stackoverflow.com/questions/2784679/manually-writing-the-html-in-twebbrowser">Manually Writing the HTML in TWebBrowser</a></p> <p>This time around I'm trying to add some auto-refresh logic to the HTML I get. I have pieced together an approach from several sources (see below). In short, I am trying to locate the title node and add a meta node after it (in the HTML head node). But, I get an access violation.</p> <p>Here is the source:</p> <pre><code>iHtmlDoc := IHTMLDocument3(WebBrowser1.Document); iHtmlEleTitle := IHTMLElement2(iHtmlDoc.getElementsByName('title').item(0, 0)); iHtmlEle := IHTMLElement2(IHTMLDocument2(iHtmlDoc).createElement(Format('&lt;meta http-equiv="refresh" content="%d"&gt;', [1]))); iHtmlEleTitle.insertAdjacentElement('afterEnd', IHTMLElement(iHtmlEle)); </code></pre> <p>And A (technically not functionally) different way of doing it ...casting is slightly different here:</p> <pre><code>IHTMLElement2(IHtmlDocument3(WebBrowser1.Document).getElementsByName('title').item(0, 0)).insertAdjacentElement('afterEnd', IHTMLDocument2(WebBrowser1.Document).createElement(Format('&lt;meta http-equiv="refresh" content="%d"&gt;', [VPI_ISSUANCE_AUTO_RELOAD]))); </code></pre> <p>Again all I get from Delphi is a access exception, and I fished through MSDN documentation on it, but now I'm hoping someone out there has gone through the same and has some insight. Any help?</p> <p>Sources (I think this is all of them): <a href="http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm" rel="nofollow noreferrer">http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm</a> (auto-reload)<br> <a href="http://delphi.about.com/od/adptips2005/qt/webbrowserhtml.htm" rel="nofollow noreferrer">http://delphi.about.com/od/adptips2005/qt/webbrowserhtml.htm</a> (web browser document as an HTML document)<br> <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.insertadjacentelement(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.insertadjacentelement(VS.80).aspx</a> (GetElementsByName)<br> <a href="http://www.experts-exchange.com/Web_Development/Components/ActiveX/Q_26131034.html" rel="nofollow noreferrer">http://www.experts-exchange.com/Web_Development/Components/ActiveX/Q_26131034.html</a> (insertAdjacentElement)<br> <a href="http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23407977.html" rel="nofollow noreferrer">http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23407977.html</a> (GetElementsByName) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload