Can you tell if a particular page is being opened within iframe
?
I want this page to execute a function when it loads through iframe
. Otherwise, I want it not to execute.
Is there any way to do this?
Can you tell if a particular page is being opened within iframe
?
I want this page to execute a function when it loads through iframe
. Otherwise, I want it not to execute.
Is there any way to do this?
@AndersonCarlosWoss suggestion may give security error. You have a comment here: link
One solution I found was in this post from the SO in English: link
The code is this:
var ehFrame = window.frames.length + ':' + parent.frames.length;
Basically returns:
'0:0'
when there is no frame% '1:1'
when executed in the "parent" window that has the iframe
'0:1'
when executed in the "daughter" window
I think this should help you.