2

I'm trying to use OpenLayers in a TWebBrowser in Delphi.

When I open a simple example from their site using OpenLayers v4.3.1, I don't seem to be able to pan the map.

WebBrowser1.Navigate( 'http://openlayers.org/en/latest/examples/simple.html' );

I've set the embedded webbrowser mode by using code found in another post. setEmbeddedWebbrowserMode( iemIE10 );

OpenLayers v3.4 seems to work, however. I'm able to use the following fine: WebBrowser1.Navigate( 'http://www.acuriousanimal.com/thebookofopenlayers3/chapter01_01_basic_map.html' );

I'd like to be able to use the most recent API if possible. Any idea why the new one isn't working in TWebBrowser?

SBaz
  • 23
  • 3
  • There is no such thing as XE10. – David Heffernan Aug 16 '17 at 17:02
  • Rather than us try to recreate what you are doing, it would help if there was a [mcve]. – David Heffernan Aug 16 '17 at 17:04
  • Thanks for your help and quick response David! There really is only one line of code to get this to work. It should just be loading an HTML page with a simple openlayers map. I tried re-wording my original question as well. Hopefully that helps. – SBaz Aug 16 '17 at 17:08
  • It's the attempts to avoid compat mode that matter really. – David Heffernan Aug 16 '17 at 17:13
  • got it! I tried two methods, the first was embedding the metadata into the page. Without it, it didn't load at all and get the js error with the open layer api. Secondly, I also added an entry to the registry: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION REG_QWORD 0x00002711 (10001) – SBaz Aug 16 '17 at 17:21

1 Answers1

0

The problem with the examples is that they contain document mode meta tag for the EdgeHTML mode:

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

and they do not work properly with IE11 web browser control (we faced a few problems with mouse input as well). Advice here is simple, serve a proven copy of OpenLayers library to your clients and before they get full compatibility with IE11, try to use IE10 mode in your web application:

<meta http-equiv="X-UA-Compatible" content="IE=10">

or use another embedded web browser control (e.g. CEF based).

Victoria
  • 7,822
  • 2
  • 21
  • 44
  • 1
    I made a copy of the page and hosted it on our server without the meta tag and everything worked!! thank you very much for your help!! – SBaz Aug 17 '17 at 14:50