Forum Moderators: coopster

Message Too Old, No Replies

how do you tell if a page view is a direct hit, iframe view, or other

         

zRonin

6:28 am on Jun 16, 2005 (gmt 0)

10+ Year Member



How can one tell if a hit on a PHP page was generated from an iframe, object/img tag, or a direct hit?

mincklerstraat

7:53 am on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You look at $_SERVER['HTTP_REFERER'] (or if you're not scripting, you look at your apache logs for the referer). If the user hasn't turned off referer logging, this will be where the 'hit' came from.

zRonin

3:19 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



How about determining whether the page is being accessed using an iframe, an object/img tag, or just being accessed directly?

mincklerstraat

8:52 am on Jun 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For frames: you could use javascript to see if there's a "parent" window. Google "javascript framebreaker" and you'll probably find some javascripts which have parts which determine whether your page is inside a frame.

For images: I'd guess you can do something similar but I don't know javascript well enough, you'd probably do best to ask in the javascript forum.