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
Active
Viewed 390 times
3 Answers
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.

Jasper Mogg
- 924
- 2
- 8
- 23
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.