PDA

View Full Version : How to read javascript objects/vars


Jawelin
02-09-2002, 01:19 PM
How could I read the value of some js object (or variable) within a php page ?
Sorry but I'm a newbie at phpinfo-related web vars and functions.

Actually I would need to know, within a page, if that page is opened as a new window or as a frame in a frameset.

Normally I'd do this verification in js checking something like :
[b]if top.name == window.name[b] or similar.

But in php how could read those web page objects ?
Thnx

Scott MacVicar
02-09-2002, 04:09 PM
PHP is a server side and not client side so you'll have problems finding out information about the client other that what is sent in the headers to the server.

The simpliest way would be to call it into the script.

like
document.write("file.php?top="+top.name+"&window="+window.name);

and then just have file.php look at the values and produce that, also I doubt that javascript will work, its not exactly my forté