0

I am having lots of issues on a website because my jQuery is causing errors due to the fact that it is being rendered inside of an iFrame. Is there any way I can tell my jQuery not to load when it is inside of an iFrame?

asked Jun 22, 2012 at 20:18
1

3 Answers 3

1

from @Greg answer

if (top === self) { not in a frame } else { in a frame }

top and self are both window objects (along with parent), so you're seeing if your window is the top window.

Greg answer

answered Jun 22, 2012 at 20:29
Sign up to request clarification or add additional context in comments.

Comments

1

This should work:

window.opener != null
answered Jun 22, 2012 at 20:23

Comments

1

As Greg said in the link in the comment on the question, you can use 'if(top===self){ outside iframe code here } else { inside iframe code here}' to do this.

answered Jun 22, 2012 at 20:29

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.