jmansa — 2011-03-05T16:10:58-05:00 — #1
Not sure if this should be in the PHP forum or here but here goes...
I'm trying to get this to work but with no luck...
var lala = top.location.href;
$topurl = $_GET['lala'];
echo 'Whats the url:'.$topurl;
Thanks in advance
gar_onn — 2011-03-05T18:39:39-05:00 — #2
Your code will not work becouse PHp is prossed before jour jaascript starts.
So your PHp part will loas first.
what you can do is sen the data via a redirect.
howevver what is the aim of knowing the top location?
jmansa — 2011-03-05T18:45:57-05:00 — #3
Not sure what you mean?!?!
gar_onn — 2011-03-05T18:55:26-05:00 — #4
First you need to know that PHP code is ran at the server side;
(so everything between <? ?> is executed before your browser starts reading the page.
When the page is read, your browser runs all scripts between <script> tags. (ans parses HTML)
jmansa — 2011-03-05T18:59:41-05:00 — #5
How can I change this?
jmansa — 2011-03-05T19:28:20-05:00 — #6
The reason for all this is that I'm trying to make my page available on facebook to. And as I'm making my page a FB app using iFrame I would like to know if the user is getting to my page through facebook og just as my plain http://www.mypage.com
So I need to know if the page is as a child or as a parent... Does this make sense?!?!
felgall — 2011-03-05T19:59:11-05:00 — #7
You might be able to tell where your visitor is from by checking the referer header in PHP (assuming your visitor hasn't turned it off)
jmansa — 2011-03-06T03:53:56-05:00 — #8
Well, if I use this: