php - Redirect if site is not shown in a frame -
php - Redirect if site is not shown in a frame -
i have page want visible if shown in iframe.
is possible in php, htaccess or something? how?
i prefer solution in php
thanks!
frames client side can't check through php or .htaccess. can check in javascript. see thread:
how identify if webpage beingness loaded within iframe or straight browser window?
edit here's illustration redirect you. it's straight javascript if doing jquery write same function document.ready
<script> function check_frame() { if( top === self ) { // not in frame location.href = "/link/to/some/url"; // either frameset or error. } } </script> <body onload="check_frame()"> ... normal code page here ... </body>
note page can still php page, need output bit of javascript.
php .htaccess redirect
Comments
Post a Comment