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.

Get html code with line breaks

Post Reply
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get html code with line breaks

Post by salvadordf »

CEF4Delphi doesn't change the string returned by CEF when you call TChromium.RetrieveHTML. It seems that Chromium returns "cleaner" HTML.

By cleaner I mean that the rendering engine collapses whitespace as the CSS specs dictate. The rendering results are exactly the same if the raw HTML has some extra CRLF sequences or consecutive spaces in some places.

Try the JSExtension demo and use the "Visit DOM in JavaScript" option in the context menu. JavaScript seems to keep more line breaks in the HTML results.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get html code with line breaks

Post by salvadordf »

The DevTools shows the DOM nodes in a tree structure. It doesn't show the original HTML. It only adds all the DOM nodes to the tree.
Compare the raw HTML from google.com with the tree nodes shown in the DevTools to see the difference. ;)

If you need the raw HTML code then use the "Visit DOM in JavaScript" option in the JSExtension demo as I mentioned before.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get html code with line breaks

Post by salvadordf »

Please, download CEF4Delphi again and try the new context menu option in the DOMVisitor demo called "Visit DOM in CEF (BODY HTML)". It will copy the HTML inside the body element to the clipboard.

The JSExtension demo can also be used to get the HTML by using the "Visit DOM in JavaScript" option in the context menu.
Post Reply