Пояснение к тому что я имел ввиду изначально:
<script>
var elem = window;
alert([ ' Normal window:',
'elem.setInterval:\t\t' + !!elem.setInterval,
'elem != window:\t\t' + (elem != window),
'!elem.frameElement:\t' + !elem.frameElement,
(elem.setInterval && ( elem != window && !elem.frameElement ) )
].join('\n'))
</script>
<input type="button" onclick="
var elem = window.open('about:blank');
alert([ ' New window:',
'elem.setInterval:\t\t' + !!elem.setInterval,
'elem != window:\t\t' + (elem != window),
'!elem.frameElement:\t' + !elem.frameElement,
(elem.setInterval && ( elem != window && !elem.frameElement ) )
].join('\n'))
" value="click me">
<iframe src="about:blank" onload="
var elem = this.contentWindow;
alert([ ' Frame window:',
'elem.setInterval:\t\t' + !!elem.setInterval,
'elem != window:\t\t' + (elem != window),
'!elem.frameElement:\t' + !elem.frameElement,
(elem.setInterval && ( elem != window && !elem.frameElement ) )
].join('\n'))
" style="position:absolute;top:-800px;">