2

Is it possible to block iframe's contents for calling from browser alone?

For example;

domain.com/index.php has iframe.php in it.

index.php

has session also iframe.php has. But when session start, user can call iframe.php as

domain.com/iframe.php
Padmanathan J
  • 4,614
  • 5
  • 37
  • 75
acidburnr
  • 25
  • 4

1 Answers1

2

If javascript is an option, you may detect if iframe is opened in browser directly:

<script type="text/javascript">
if (top.location == self.location) {
    top.location = "http://homepage.com";
}
</script>

Another option is a usage of $_SERVER['HTTP_REFERER'], as mentioned here.

Community
  • 1
  • 1
BlitZ
  • 12,038
  • 3
  • 49
  • 68