4

How Can I get a DOM reference to the canvas Handle. I'm using Delphi, IE11 and the corresponding MSMHTML Type library,I suspected it's along the lines of

canvasHandle := (HTMLDoc3.getElementById('canvas') as IHTMLCanvasElement);

the Html:

<canvas id="canvas">
  ....
</canvas>

however this throws an exception 'Interface not supported'

kobik
  • 21,001
  • 4
  • 61
  • 121
Mark
  • 43
  • 1
  • 3
  • 4
    Are you using a `TWebBrowser` control to obtain `HTMLDoc3`? if yes, then I guess you need to specify rendering/browser mode for it. default rendering mode is IE7. look for [`FEATURE_BROWSER_EMULATION`](http://www.google.com/search?q=FEATURE_BROWSER_EMULATION+IE11), or add a `"meta http-equiv-'X-UA-Compatible' content= edge"` to the `` block of a webpage to force Windows IE to use the latest standards. – kobik Nov 12 '13 at 10:02
  • Yes: I should have made that point clear, I am using the TWebBrowser control however HTMLDoc3 works fine as I tested it on other tags without any problems what looks promising is placing "meta http-equiv-'X-UA-Compatible' content= edge" to the block of a webpage – Mark Nov 12 '13 at 12:25
  • Applying Kobik's suggestion of adding "Meta http-equivalent' did solve the problem, would accept if posted as an answer, – Mark Nov 14 '13 at 09:19
  • 1
    @kobik, ping :-) Mark, please use `@` before the user's name to notify us through comments. We don't need to do that since you're the owner of the post and so you're always notified. Thanks! – TLama Nov 14 '13 at 17:02
  • 1
    @TLama, Reply from "kobik": Thanks :) – kobik Nov 14 '13 at 17:49

1 Answers1

3

TWebBrowser control, by default uses IE7 standards/rendering mode.
You need to tell the control to use latest standards. There are a few ways of doing this.

Here are two of the ways known to me:

  • Either you specify FEATURE_<some feature> for your application in the registry (.e.g. FEATURE_BROWSER_EMULATION also a nice article here).

  • Add a "meta http-equiv-'X-UA-Compatible' content= edge" to the <head> block of a webpage to force Windows IE to use the latest standards.
    This will enable your HTML5 functionality working without the need for registry tweaks.

kobik
  • 21,001
  • 4
  • 61
  • 121