I have a string containing some HTML and maybe JS code that comes from a third-party site and may contain malicious code trying to steal cookies from my site.
I am using the following code in my site to preview it on my site.
<iframe id='fff' />
var iframe = document.getElementById('fff'),
iframedoc = iframe.contentDocument || iframe.contentWindow.document;
iframedoc.body.innerHTML = third_party_code;
To test it against XSS, I tried the following code
iframedoc.body.innerHTML = '<script>alert(parent.document.cookie);</script> ';
The code doesn't popped any message box. So, Can I assume my site is safe from XSS attack or am I missing something?