Re: Calling a javascript using header();

From: Date: Wed, 13 Sep 2000 09:57:22 +0000
Subject: Re: Calling a javascript using header();
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16529@lists.php.net to get a copy of this message
You can't do this because it's not a valid URL. You're probably thinking that by using the Location header, you're simulating the clicking of a link, but you're not - you're simulating the step _after_ the click, which is the browser making a http request for a host and file. This isn't what happens when you click on an html anchor which links to javascript:something() - what happens instead is your javascript-enabled browser performs a javascript method, or a function defined within the same page somewhere. What you might do instead of the Location header, is after processing your user input, print out: <body onLoad="window.close()"> jason ----- Original Message ----- From: "Jesper Hess Nielsen" <jesper@graffen.dk> To: <php-general@lists.php.net> Sent: Wednesday, September 13, 2000 7:36 PM Subject: [PHP] Calling a javascript using header(); Hi all I'm trying to execute a piece of javascript code (to close the current window after processing some user input) using the following code : header("Location: javascript:window.close();"); what is the correct way of doing this, cause I certainly can't get it to work right for me?? /Jesper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#16529) next »