Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Document instance

Post Reply
vthourte
Posts: 2
Joined: Wed Oct 19, 2022 2:16 pm

Document instance

Post by vthourte »

Hello! I recently changed my delphi application to use TWVBrowser instead of TWebBrowser, which used Internet explorer engine to work.
This last class had a Document property, whose body was used to get latitudes and longitudes on a Google maps map. Is there any alternative to this property in TWVBrowser? I imagine it's in there somewhere since i can access the document title.
Any help would be appreciated
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Document instance

Post by salvadordf »

Hi,

Read this to know more about the DOM access feature request :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/77

For now, you can execute JavaScript or use the DevTools methods to access the DOM.
vthourte
Posts: 2
Joined: Wed Oct 19, 2022 2:16 pm

Re: Document instance

Post by vthourte »

Hi!
Thanks for the quick answer.
I think i could get away with JavaScript, though there's something I'm not quite getting.
I dont need to manipulate the DOM, instead I need to get and element value by its ID.
I can call the JavaScript function but I dont understand where the result im asking is left.
Sorry if my question sounds dumb or low level, I dont have much experience with web development and the way it functions.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Document instance

Post by salvadordf »

You can execute any custom JS code and send the results to Delphi using the functions that you can find in the BrowserHostAppCommunication demo.
Post Reply