I know how to write into an iframe:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Writer</title>
<style>
textarea,
iframe {
display: block;
width: 800px;
height: 200px;
}
</style>
</head>
<body>
<textarea id="ta" oninput="writeIt();"></textarea>
<iframe id="frm"></iframe>
<script>
function writeIt() {
var ta = document.getElementById('ta');
var frm = document.getElementById('frm');
var frmDoc = frm.contentDocument;
frmDoc.open();
frmDoc.write(ta.value);
frmDoc.close();
}
</script>
</body>
</html>
There’s a problem, though. Enter the following into the textarea:
<a href=“http://www.example.com/”>Example.com</a>
Now click on the link, and then get back to the textarea to continue writing. It doesn’t work anymore due to the cross-origin restriction. Is there any way in this case to continue writing?