Link to home
Start Free TrialLog in
Avatar of sidwelle
sidwelleFlag for United States of America

asked on

html shows up wrapped in <pre> tages ??

Using a browser to read a html page, but the browser wraps the html page in <pre> tags?

I am trying to get the status of a service, and I have the service returning the status as an html page on port 10001.
Works, but the page shows like the browser wrapped the page in <pre> tags and I see the raw tags of the html page instead of  how it was intended to be rendered.

Why would the browser do this ?  tested w/IE and FF, both show the raw page.

Thank you.
Avatar of Dr. Klahn
Dr. Klahn

Before providing HTML pages, the browser and the "server" must negotiate the content.  I suspect that this is what is missing.  Merely sending HTML without a negotiation will result in the content being treated as text.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation
Do you have a <!DOCTYPE html> at the top of your page?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You might want to show us how the code is retrieving and outputting the Service result. It's possible that the content is having the HTML tags converted to HTML Entities, so when you retrieve the result, something like <h1> would come back as &lt;h1&gt; This would then output the HTML tag as text rather than rendering it.

Follow Julian's suggestion and view the Page Source to see what that looks like.
Avatar of sidwelle

ASKER

Thank you to everyone that contributed.

I went back in the MIRTH channel and I configured the output to 'RAW', was 'Delimited TEXT'.
Added <!DOCTYPE html> at the beginning of page.
Started working as desired. Tested in I.E. and F.F.

Negotiation: I didn't realize that an HTML load when though all the negotiation like that of a FTP transfer, I thought it was more a file dump and the browser did its best to read it ?   That is a great link, I will continue to study it.  Thank you.

I do see some fields for 'response headers', but I have no idea what should be there.
FWIW
  • As Chris suggested, it is better to place your js code in a separate file, which by example can easily be cached and shared between your different html pages
  • In most cases (but not all) it is usually better to place your js code (or the link to the js file) at the end of your html code, between </body> and </html>

Why? Nothing will display in the browser on the client while the js loads and runs. Sending first some html code wil start the display on the screen.