0

My goal is to create a delphi XE8 project (VCL or fireMonkey) that will interact with webbrowser.

I want to use the power of JS (jquery) to access DOM, extract some data and send them back to delphi.

I try to use twebbrowser and... any page gives me tons of JS errors : I think twebbroser is based on a very old browser such as Internet explorer8

I run windows7 + IE11

1) Should I go to chromium browser ? (Tchromoium or chromiumembedded ?)

2) How to make it communicate with Jquery ?

Regards

yarek
  • 8,962
  • 25
  • 93
  • 180
  • possible duplicate of [How to have Delphi TWebbrowser component running in IE9 mode?](http://stackoverflow.com/questions/25843845/how-to-have-delphi-twebbrowser-component-running-in-ie9-mode) – whosrdaddy Sep 10 '15 at 13:52
  • 1
    Hi yarek, only one question at a time please. By default the embedded browser will be in IE7 mode, you need to add a registry key (check out dupe link) or if you have the webpage under control, add a meta http-equiv tag to the page header. – whosrdaddy Sep 10 '15 at 13:54
  • To answer the second part, you can browse the DOM directly from the embedded browser, no need for javascript, look [here](http://www.cryer.co.uk/brian/delphi/twebbrowser/twebbrowser_oleobject.htm) for more info.. – whosrdaddy Sep 10 '15 at 13:55
  • But I jquery is MUCH more flexible ex: imagine that: $("div.myClass image[alt='hello']); I guess that will be much more difficult to get that in delphi. The goal is to create a data extractor, so Jquery selecting DOM is really what I need. – yarek Sep 10 '15 at 14:01
  • Do you have the page under control? – whosrdaddy Sep 10 '15 at 14:07
  • 1
    No: it's not my page ! – yarek Sep 10 '15 at 14:19
  • If you don't have the page under control, it is possible that jquery is not loaded, so you would need to [inject](https://github.com/jasonpenny/twebbrowser.utilities/blob/master/lib/uWebBrowser.pas) an external jq cdn reference to the dom and then [execute some js](http://delphidabbler.com/articles?article=21) – whosrdaddy Sep 10 '15 at 14:24
  • Anyway, you can do the same without jquery, all you need to do is translate the selector code from jq to a delphi equivalent... – whosrdaddy Sep 10 '15 at 14:26
  • so hardi in delphi: you need to compile, change, test. Whereas in jqueru and google dev tool it is so simple. INfact I was doing that in pure delphi before and that's why I decided to use jquery – yarek Sep 10 '15 at 14:30
  • maybe you need to do [something like this](http://stackoverflow.com/a/5668168/800214), or [this](https://scotch.io/tutorials/scraping-the-web-with-node-js), ... then? – whosrdaddy Sep 10 '15 at 14:35

0 Answers0