NYCPHP Meetup

NYPHP.org

[nycphp-talk] More Client-Side Grief

Hans Zaunere zaunere at yahoo.com
Tue Oct 29 16:36:15 EST 2002


> This isn't so much a problem with PHP, but I hope someone can help
> out with some JavaScript issues I'm having.

Wow, thanks for the all the responses.

After picking bits from each post, I've finally done something like:

-- the PHP script that handles the form POST prints this to the popup:

<script language="JavaScript">
   if( opener ) {
      opener.location.assign('<?=$next?>');
      opener.location.reload(true);
      window.close();
   } else {
      window.location.assign('<?=$next?>');
   }
</script>

where $next is where I want the main browser window to go.  I had
considered passing the next URL in through the JavaScript call to
create the popup (and this does seem to give the most flexibility), but
really wanted to maintain my redirects from the server (I have a DB of
"if posted from there, you now go here" that changes frequently).  This
isn't as direct as sending a HTTP header, but heck, it seems to work
(and still covers non-popups).

Ideally, I would have wished there was a way to read the HTTP headers
sent from PHP into JavaScript/JScript and then act on them.  Supposedly
there is
(http://msdn.microsoft.com/workshop/author/dhtml/reference/constants/response_headers.asp)
but as with so much client-side, I could never get them to do anything.
:)

Thanks again,

H



__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/



More information about the talk mailing list