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.
+6
A:
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.
bigmattyh
2009-09-03 08:50:08
Thanks. Wasn't really sure. Just wanted to see if there was a way to do it without using JavaScript just incase there's the slim chance a user has JavaScript disabled. Thanks.
Nate Shoffner
2009-09-03 08:51:31
+1
A:
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.
MathieuK
2009-09-03 08:51:48