When I execute
$('body').append('helo')
inside iframe
, the string was appended to the parent.
How can I avoid this behaviour without changing the script inside the iframe
.
When I execute
$('body').append('helo')
inside iframe
, the string was appended to the parent.
How can I avoid this behaviour without changing the script inside the iframe
.
Maybe try something like this:
but it is not easy. i have found another source here
<iframe id="demo"></iframe>
var frame = document.getElementById("demo");
var html = 'data:text/html;charset=utf-8,' +encodeURI('<body>Hello</body>');
frame.src = html;
I would personally use DIVs as it is very good and useful, can do everything an iFrame can do and more (Yes, maybe there is something that i do not know of, but nothing which I use in my everyday web development life!). iFrames is old and poor
EDIT: Just found this jsFiddle, Problem solved
Just to help others, please refer to the following answers:
Why does appending a to a dynamically created seem to run the script in the parent page?
It works.