Of course, all people who are knowledgeable in the field know that HTML isn't a programming language. But that doesn't stop anyone from trying to get an HTML page to display its own code when viewed in a browser, especially now we have JavaScript to assist the process. Unfortunately, this first one is a cheat. It works in Internet Explorer 5.x, and generates an almost identical quine in Mozilla. It fails in Netscape 4.x; I don't know about Opera and others. (Try it!):
<BODY> <SCRIPT>document.write(('<BODY>'+document.body.innerHTML
+'</BODY>').replace(/&/g,'&').replace(/</g,'<'))</SCRIPT></BODY>
This isn't quite valid HTML (it lacks a DOCTYPE declaration and a title), but you get the idea.
The next one is a pure JavaScript quine, works in both IE and Netscape, and doesn't include whatever HTML may surround it (Try it!):
p="document.write('p=\"',p.replace(/\"/g,unescape('%5c%22')),'\";',p)";
document.write('p="',p.replace(/"/g,unescape('%5c%22')),'";',p)
Both of these work best with the interior line break removed.