hey there,
I know that in Javascript you can use window.top.location to check if your website is being iframed but I was wondering if there is anyway to do that in PHP?
I would like to retrieve the url of the website that is iframing me and do something.
Thanks!
Check if website is being iframed
Moderator: General Moderators
Re: Check if website is being iframed
I don't know of any way to do it in PHP, sorry. Here's the Javascript.
[syntax]
if (top.location != location)
top.location.href = document.location.href;
[/syntax]
[syntax]
if (top.location != location)
top.location.href = document.location.href;
[/syntax]
Re: Check if website is being iframed
Any way to do this in PHP?
Re: Check if website is being iframed
PHP doesn't have a way to access nested window/iframe information, that's something you have to use Javascript for but you could always pass the information from Javascript back to PHP or run the Javascript by building it in PHP code. There's also Ajax.