I know you can get the innerHTML doing something like this, with jQuery,
$('iframe').load(function(){
alert($(this).contents().find('body').html());
});
This gets the innerHTML of the body tag. But I want it all. I want the HTML tag and the doctype. The whole source code basically. And I want to be able to edit it as a whole as well. By "as a whole", I mean I wanna be able to do something like this,
$('iframe').html('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>title</title>
</head>
<body>
hello world
</body>
</html>');
How do I do this?
Note: I realize DOM is handled differently in different browsers and so the innerHTML from Opera will look different than the one from Firefox. But it's no biggie.