PHP - Break out of a frame
-
21-09-2019 - |
Question
Is there a way to break out of a frame using PHP? I have done it with JavaScript, but I would really prefer to use PHP instead. Thank you.
Solution
Frames are a client-side issue. Javascript is the solution, because it is a client-side scripting language that has awareness of the browsing context. Frames are meaningless on the server-side.
So, only client-side code can do this. Not PHP.
OTHER TIPS
PHP is server-side. It merely generates the HTML for a page. As such there is no way for it to determine whether its output is being shown in a frame.
The best PHP can do for you is outputting the Javascript code to break out of a frame.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow