Delphi WebBrowser need true source

Posted on 2012-08-20
Last Modified: 2012-11-04
Delphi WebBrowser view is  eat spaces.
I use the webbrowser element all the time.
But I am doing an app and there is a consern it is
removing spaces (not Carrage Returns) from the text.

It is a very standard call,
I tested all Inner, outer, text and html
all return the same line of text , with only single spaces,
between works,  the provider says the string should have
spaces to I can wrap at 76 Chars.  
The Line I get back has 'no' Carrage returns in it , by design

HOW DO I KNOW IT IS EATING SPACES, not returning them to me.
if I I right click the window and view source you see the spaces in Notepad.
But the iall.outerHTML; innerHTML ect does not return
what I see in Notepad when I view source

HELP  How do I fix this. ??

procedure TForm1.GetCompleteHTMLSource(wb: TWebBrowser);
  iDoc: IHTMLDocument2;
  iall : IHTMLElement;
  if Assigned(wb.Document) then begin

    iDoc := wb.Document as IHTMLDocument2;
    iall := iDoc.body;

    while iall.parentElement <> nil do begin
      iall := iall.parentElement;

    Memo1.Text := iall.outerHTML;

Question by:yahoolane
    LVL 36

    Expert Comment

    by:Geert Gruwez
    if the webbrowser being used follows the W3C standards ( then you can use the "no breaking space" &nbsp; instead of a space to align data

    if you want to align characters you should use a single width character type (like Courier new)

    however all this *behaviour* can be overridden by a style sheet

    there is no sure way for you to control the visual output at the other end
    LVL 36

    Expert Comment

    by:Geert Gruwez
    next to that... the web pages can be created dynamically by sources you can't access
    you can even write a delphi program which throws you random pages with random content

    what are you trying to accomplish ?
    LVL 25

    Accepted Solution

    Take a note - outerHTML is what you see and innerHTML is html source of that. If you assign
    outerHTML to memo you surely lost something. Try to save raw data to file and look with hex view editor. If you want all of html source, try to iterate all frames first or look
    something like this:
    LVL 1

    Author Closing Comment


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now