Topic: Twebbrowser

Hi Dmitry,
Hope you are well.
In my program I click on a row in a tablegrid and it uses the postcode(zip code) to access google maps.
If I use 'openurl', it opens a new window in my browser (Chrome) and takes me to the correct web page (lines 92-100 in my script).  This works well.
But I want to show google maps displayed inside my form;  for this, I am using twebbrowser and the navigate command.  However, when I do this, I get an error message (please see screenshot1.jpg).
I can possibly fix this for my own PC but I have no way of knowing which version of which browser is installed on any other PCs where my program is running.
So my question is - is there any way of achieving this by using whichever browser is installed on the PC where my program is being used?
Thanks for your help,
Regards,
Derek.

Post's attachments

Attachment icon contacts.zip 600.64 kb, 493 downloads since 2017-04-29 

Re: Twebbrowser

Hello Derek,


Normally, the Default browser is a Windows registry thing and, unless it is not set (which does not open often), the "openurl(v1+v2);" instruction should work on pretty much any computer.
I've tested on mine, on my wife's and on my daughter's and it worked on the three. But then , they are all Windows 10 so this is not really a relevant test.
SIDE NOTE : if you opt for the "openurl" solution, I suppose you also comment the"map.Show;" instruction in order to avoid opening the map form when not needed ?


Regarding the "web.navigate(v1+v2);" instruction, the TWebBrowser created is relying on TidHTTP (if I remember well what Dmitry said) embedded on MVD and one of it's parameters is "User Agent". This parameter tries to "mimic" the behavior a the set browser to be recognized as such by the server hosting the address/page you try to display.


I've tried this option in your app and have either :

  • gotten a map but with the Google warning saying my browser was working in compatibility mode and that the map would not work correctly

  • gotten a warning window saying I was not using a compatible browser


I'm not sure which UserAgent Dmitry as set by default, but this is a parameter we can not change, just like the Connect.Timeout and so on. Maybe you should ask him and see if he could maybe set the default user agent to a more recent one ?


Not sure this helps a lot


Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Twebbrowser

Hi Mathias,
Hope things are good in your corner of the world.
Thank for having a look.  I've not had any problems on any one's PC when using 'openurl' but wanted to get it working with twebbrowser because it just looks integrated.
The map.show line is in the script to show Dmitry the steps I'd taken but if this problem can't be fixed, I can take most of that section out.
I believe there is a registry 'tweak' but I don't know every machine where my app is being used so that's not a solution for me.
Maybe Dmitry can think of something.
Regards,
Derek.

Re: Twebbrowser

Hello.


I have changed user agent for the browser. Please download latest beta version
https://www.dropbox.com/s/4sb2tk75rauoj … b.zip?dl=0



Also I made some changes in your project:

Post's attachments

Attachment icon contacts_fixed.zip 15.65 kb, 521 downloads since 2017-05-02 

Dmitry.

Re: Twebbrowser

Hi Dmitry,
Thanks for doing this. I am on vacation at the moment, but will test it when I am back home and let you know how I get on.
Regards,
Derek

Re: Twebbrowser

Hi Dmitry,
Thanks for having a look at this problem.
I have downloaded the changes you made (contacts_fixed.zip) as well as the MVD 3.4b from Dropbox.
When I now try to access Googlemaps from within my application, I get the following error message:
"invalid floating point operation"
Do you have any idea what might be causing this?
Regards,
Derek.

Re: Twebbrowser

derek
I have tested your project from first post using v3.4b but there is no any error messages.
Please attach your project and describe steps to reproduce the error.

Dmitry.

Re: Twebbrowser

Hi Dmitry,
Please see the attachment.
Enclosed is the fixed project that you changed for me a couple of days ago.
The steps I take are:
1.  I create the executable using Version 3.4b (screenshot cf1.jpg)
2.  I click on any row in the grid and select 'Show On Map' (screenshot cf2.jpg)
3.  A browser window opens WITHIN the application which is correct -  but nothing else happens (screenshot cf3.jpg)
4.  After 3-4 second, the browser window closes and the error message displays (screenshot cf4.jpg)
5.  If I try to repeat this, I get a different error message (screenshot cf5.jpg)
If I quit the application, open it again and repeat steps 1-5 above, the same thing happens.
The browser that I use is Chrome but other users of this application may be using a different browser.
I am using Windows XP but other users of this application may be using a different Windows OS.
If you need any more information, please let me know.
Thanks,
Derek.

Post's attachments

Attachment icon contacts_fixed.zip 1.88 mb, 515 downloads since 2017-05-09 

Re: Twebbrowser

derek
Hello.


twebbrowser is Internet Explorer, unfortunately I can't fully control this component, perhaps you have old version of IE.


Check out another method to use google maps:

Post's attachments

Attachment icon GoogleMaps.zip 38.25 kb, 540 downloads since 2017-05-10 

Dmitry.

Re: Twebbrowser

Hi Dmitry,
I understand what you're saying about not having full control over the component. 
Instead, I have used your googlemaps api (static map) suggestion and then, if required, make an external URL call to the 'interactive' google maps.
It works quite well.
Thanks for having a look and for your help,
Derek.

Post's attachments

Attachment icon contacts_fixed.zip 571.65 kb, 585 downloads since 2017-05-12