actuly i need if my site page run in a iframe then display a code if not in iframe the display another code. i need to do it with php. did you think its possible ?
i need the js condition in my php. how way write it ? its for iframe. go top or iframe Break any one help me js is
if (top != self){
document.writeln("Hi");
}
else
{
document.writeln("Bye");
}
how to write it in Php
or these way
<?php
if ( $i == 1) {?>
<script type="text/javascript">
if (top != self){
document.writeln(" <?php $i = 1; ?> ");
}
else
{
document.writeln(" <?php $i = 2; ?> ");
}
</script>
<?php
if ($i == 1)
{
echo "hi";
}
else
{
echo "bye";
}
}
else {
echo "else hi";
}
?>
if its possible like these way help me pleas
Comparing top to self is checking if your HTML code is executed in a frame or not. Frames are client side techinique which PHP has no knowledge about, so you cannot express that in PHP.
Only thing you can do for frames is check for http_referer, but that's not the same thing at all. This example shows how that is done. Using that, you would check if referer matches your site or not. However, then you have other issues as that is not very reliable, and could end up blocking going through regular links as well.