sprugman
sprugman

Reputation: 19831

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?

Upvotes: 5

Views: 188

Answers (4)

Daniel Cassidy
Daniel Cassidy

Reputation: 25607

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);
}

Upvotes: 1

James
James

Reputation: 31738

If you wanted to put the effort in, you could write a plugin(for all browsers) or active x(for ie) to determine this as they are not blocked from accessing the clients computer as much as javascript ect.

Upvotes: 0

Shane N
Shane N

Reputation: 1742

Wouldn't it show up in your server logs as the referrer? I know that's not a programmatic way, but i'm wondering if you're just trying to track down people stealing your content.

Upvotes: 0

Andreas Köberle
Andreas Köberle

Reputation: 110892

No you can't access the parent window if its not on the same domain.

Upvotes: 0

Related Questions