Я пытаюсь динамически добавлять iframe с HTML на существующую страницу. Я получил iframe для загрузки и отображения. Однако «Тело» iframe не показывает. Любая помощь?Динамическая загрузка HTML в и iframe
<html>
<head>
<script>
window.onload = function() {
var iframe = document.createElement('iframe');
var html =
'<html><head>' +
'<scr' + 'ipt src="https://localhost:44302/foo.js"></scr' + 'ipt>' +
'<scr' + 'ipt src="https://localhost:44302/bar.js"></scr' + 'ipt>' +
'</head>' +
'<body>Hi</body></html>';
iframe.src = 'data:text/html;charset=utf-8,' + encodeURI(html);
document.body.appendChild(iframe);
console.log('iframe.contentWindow =', iframe.contentWindow);
}
</script>
</head>
<body></body>
</html>
https://jsfiddle.net/0m5axpxx/2/
'<ЮКЖД' + «выглядит как IPT [XSS] (https://www.owasp.org/index.php/Cross-site_Scripting_ (XSS)) – zer00ne