Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detecting where my site is iframed

I know that iframed pages can tell that they are, but is it possible to tell where? parent.location runs into security issues when parent is a different domain, as far as I can tell. Any work arounds?

like image 586
sprugman Avatar asked Nov 15 '22 08:11

sprugman


1 Answers

I haven’t tested, but you should be able to do something like:

if (window.top !== window.self) {
    alert("I am a frame. The parent document is " + document.referrer);
}
like image 136
Daniel Cassidy Avatar answered Dec 28 '22 09:12

Daniel Cassidy