Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Check if page is displayed inside iframe?

Tags:

php

iframe

I would like to use PHP to check if the page is being loaded in an iframe. Preferably, but not required, I would like to have the parent's url when applicable. Thank you.

like image 760
Mooseman Avatar asked Dec 04 '22 14:12

Mooseman


1 Answers

Php cannot tell the context for which the request is made. It doesn't know anything except what is passed to it and available as server variable. You could add your own get parameter to the url to be used when putting your page in an iframe, but otherwise you are out of luck.

like image 149
Ray Avatar answered Dec 18 '22 14:12

Ray