I am copying the "view source" of an external html page (1.html) into a variable in javascript in another html page (2.html). But due to the indentation, quotes, spaces and tags in the html page, i am not able to store all of the source code in the string at one go. Is there any function which can be used to do so?
Contents of 1.html:
<html>
<head>
<title>1 </title>
</head>
<body>
This is just plain text body
<div id="new"> This id div text</div>
<span> This is span text </span>
</body>
</html>
Contents of 2.html:
<html>
<head>
<script type="text/javascript" language="javascript">
var str="<html>
<head>
<title>2 </title>
</head>
<body>
This is just plain text body
<div id="new"> This id div text</div>
<span> This is span text </span>
</body>
</html>";
alert (str);
</script>
</head>
<body>
</body>
</html>
if a paste all the contents copied from 1.html after var=" inside 2.html, it does not take all of it.. Any solution to this?