I’m trying to change the body content (remove all the content) and then put there iframe:
function create_iframe(target){
var link = document.createElement('iframe');
link.setAttribute('id', 'target_u');
link.src = target;
document.body.innerHTML = link;
max_iframe();
}
but it prints
[object HTMLIFrameElement]
what’s the problem?
linkis a<iframe>element, not a string. Use thereplaceChildmethod instead:Or, a better approach, since
<body>should be kept, useappendChild, after clearing the body: