I just want to show a basic html document in my website, and the text includes script tags. Is there a way to show:
<script>document.write("hi");</script>
Instead of hi
?
Basically i want to NOT execute the javascript input.
I just want to show a basic html document in my website, and the text includes script tags. Is there a way to show:
<script>document.write("hi");</script>
Instead of hi
?
Basically i want to NOT execute the javascript input.
You could use a pre
tag but need to
replace all < signs with
<
and all > signs with>
<pre>
<script>document.write("hi");</script>
</pre>
Use the <
html entity to escape the tag opening interpretation of the opening angle bracket.
<script>document.write("hi");</script>
tags which make the output different from what was wished for.– loop May 07 '21 at 10:06