2
votes

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?

1
There is no such thing as XE10. - David Heffernan
Rather than us try to recreate what you are doing, it would help if there was a minimal reproducible example. - David Heffernan
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
It's the attempts to avoid compat mode that matter really. - David Heffernan
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

1 Answers

0
votes

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).