I want to display another html page on my html page, that html page is generated. So I don't have it's src, only the content. It has doctype, head, body, all stuff. So I decided to use iframe. The problem is that I can't assign the whole text to a variable, as I get errors, that there is an unsupported character, like "<" etc. How to deal with it?
I'm trying to do something like this:
window.onload = function() {
var iframeDocument = document.getElementById("myIframe").contentDocument;
var ss = "
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
</head>
<body>
</body>
</html>";
iframeDocument.write(ss);
iframeDocument.close();
}
So my problem is how to escape that text so it won't cause browser errors? Also html content is generated dynamically, so in my code there is no that text, there is struts action variable. But after my code gots executed in browser, that's what I see in there.