1. Saurabh Sharma
  2. PowerBuilder
  3. Tuesday, 10 September 2019 12:31 PM UTC

Hi,

I want to create an application which opens google map in embedded browser. When user clicks anywhere on the map, I need to get coordinates (longitude and latitude) of that location in PB code.

I developed customer HTML with java script code for this but when I set this HTML in OLE object, I get java script error (but same HTML works fine when I save it in HTML file and run in IE or Chrome).

Need any suggestions or sample code for this ?

 

Thanks !!!! :)

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 00:41 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi,

So you're using the embedded MS web browser control (ActiveX)?

That one has like compatibility for IE 7 ! You can change some registry settings though, to make it "emulate IE 11".

If you download http://www.topwizprogramming.com/freecode_webbrowser.html, there should be a link build in that explains how to emulate IE 11 for the web browser control or read this link (which has a link):

https://community.appeon.com/index.php/qna/q-a/how-do-i-change-microsoft-web-browser-in-ole-custom-control-to-use-an-other-version-of-the-browser

 

What I'm not sure of, is whether "emulation" would mean it can handle IE 11 functionality or if it'll just not give errors.

Currently I have started to look at: 

https://github.com/sharpbrowser/SharpBrowser

and 

https://cefsharp.github.io

I haven't seen a "ready made" activex yet, but didn't look very far for now. This is a low priority for now for me.

My guess is I'll have to make a .net Userobject with it and then wrap it as an ActiveX to be able to use it in a PB control on a window.

The advantage of using your own wrapped version would be that you'll have greater control and support for things like HTML 5.

Please correct me anyone if IE11 emulation does support HTML5 ?

Microsoft has taken a new direction with their upcoming "webview2" but it's not very clear to me how to use that at this moment from powerbuilder. Again, I don't think they'll release an ActiveX so again you'll have to build your own wrapped one. It's based on a beta of Edge and who knows what's going to happen to Edge. I don't like that solution too much and the "Sharpbrowser" and "cefsharp" seem way easier to incorporate.

 

HIH

Comment
  1. Michael Kramer
  2. Wednesday, 11 September 2019 02:26 AM UTC
WebView2 exposes the new Microsoft Edge (Chromium) browser. Currently in developer preview. MS expect some breaking changes before GA. Hence, not yet ready for production release.

Feels like everyone is looking at adding browser features based on CEF.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 11 September 2019 02:42 AM UTC
Yes, I've downloaded some sample from git and it really looks very promising. Total control of what you want to do with the browser control and you can easily show things as simple as a url toolbar. I'm not sure, but I think that with the current old web browser control, even that is already a problem. I will try to wrap it in an activex (some day) and when activex no longer works, I hope appeon has come up with an alternative solution to using VISUAL .Net controls. For now it seems everything is centered on rest and non-visual stuff, as great as that is, but we could really use something to get away from ActiveX for visuals. Not a problem as long as we can wrap it, which I think will be for a long time.

Maybe, once I've got it working, I'll try to release it on GitLab so anyone can download it or input their improvements. Same goes for MS Chart ActiveX and Crystal Report Viewer ActiveX which we've wrapped. The only thing is .. TIME :)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 00:50 AM UTC
  2. PowerBuilder
  3. # 1

When you run your html by simply opening it in a browser, not the control, you say you don't have errors. That might be because by default lots of errors are ignored by browsers.

 

Maybe all that's missing is to code the error event:

action = ExceptionIgnore!

and the externalexception event:

action = ExceptionIgnore!

 

 

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 01:24 AM UTC
  2. PowerBuilder
  3. # 2

Can you give us an example of the html that fails?

 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 05:21 AM UTC
  2. PowerBuilder
  3. # 3

As Miguel already wrote it the reason for your problem may be the default compatibility mode of the ActiceX control.

You may change it in the registry by default.

Another way is to specify the compatibility mode in your HTML:

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

 

HTH,

René

Comment
There are no comments made yet.
Saurabh Sharma Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 05:34 AM UTC
  2. PowerBuilder
  3. # 4

HTML in attached file.

 

Attachments (1)
Comment
  1. René Ullrich
  2. Wednesday, 11 September 2019 05:51 AM UTC
Add a META for compatibility to your HTML:

meta http-equiv="X-UA-Compatible" content="IE=edge"
  1. Helpful
There are no comments made yet.
Saurabh Sharma Accepted Answer Pending Moderation
  1. Wednesday, 11 September 2019 07:21 AM UTC
  2. PowerBuilder
  3. # 5

Thanks Miguel.

It was compatibility issue only. Its resolved now !!! :)

Comment
  1. Miguel Leeuwe
  2. Wednesday, 11 September 2019 14:40 PM UTC
Great! Be careful with those settings, I've seen windows updates reset them spontaneously, so check the registry if things start failing.

Rene's answer also might be worth giving a shot but I haven't tried that yet:

Add a META for compatibility to your HTML:



meta http-equiv="X-UA-Compatible" content="IE=edge"

René Ullrich Wednesday, 11 September 2019
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.