NiksP
NiksP

Reputation: 69

Rendering encoded html on browser

We are sending an html response like below from our server to the browser (It contains a lot of java script etc but keeping it simpler here for the question)

<html><body><b>Hello</b></body></html>


but the browser instead of rendering an html page shows string containing following

<html><body><b>Hello</b></body></html> 

Browser output required is

Hello

How do we make sure that the browser instead of showing the html as a string actually renders it on the page?

Upvotes: 3

Views: 1921

Answers (1)

Quentin
Quentin

Reputation: 944054

In HTML, the < character means "Start a tag" but you are using &lt; which means "Display a less than character".

You have similar issues with > and /.

Use the characters with special meaning in HTML. Don't encode them as character references.

Upvotes: 1

Related Questions