Is there a way to close the present (active) window using PHP code?
How to close browser window in PHP?
Collapse
This topic is closed.
X
X
-
RonSTags: None -
Theo
Re: How to close browser window in PHP?
RonS <ronsteinerNO@S PAMtds.net> wrote in news:40b038bd_3 @newspeer2.tds. net:
[color=blue]
> Is there a way to close the present (active) window using PHP code?[/color]
you can insert a javascript statement to close the window after the php
code is finished. But this would only be useful if the code is supposed to
do something that the user never sees the results from... or are passed to
another window I suppose. Such as opening a child window, performing some
code, passing the results to the parent, then closing the window.
-
Tim Van Wassenhove
Re: How to close browser window in PHP?
In article <40b038bd_3@new speer2.tds.net> , RonS wrote:[color=blue]
> Is there a way to close the present (active) window using PHP code?[/color]
PHP is executed at the server-side and thus does not know about clients,
browsers or windows of those browsers.
With JavaScript you might have access to call window.close on windows
you opened with the window.open function.
Why would you want to close someone's window anyway? Most people don't
like silly webdesigners trying to mess with their windows anyway.
--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>
Comment
-
Garp
Re: How to close browser window in PHP?
"Theo" <invalid@noemai l.com> wrote in message
news:Xns94F1F3C 32C54densnews12 3@216.168.3.44. ..[color=blue]
> RonS <ronsteinerNO@S PAMtds.net> wrote in[/color]
news:40b038bd_3 @newspeer2.tds. net:[color=blue]
>[color=green]
> > Is there a way to close the present (active) window using PHP code?[/color]
>
> you can insert a javascript statement to close the window after the php
> code is finished. But this would only be useful if the code is supposed to
> do something that the user never sees the results from... or are passed to
> another window I suppose. Such as opening a child window, performing some
> code, passing the results to the parent, then closing the window.[/color]
<?php
echo '<BUTTON onclick="window .close();">Clos e me.</BUTTON>';
?>
Hey, it's PHP. ;-)
Garp
Comment
-
Andy Hassall
Re: How to close browser window in PHP?
On Sun, 23 May 2004 00:42:26 -0500, RonS <ronsteinerNO@S PAMtds.net> wrote:
[color=blue]
>Is there a way to close the present (active) window using PHP code?[/color]
No.
--
Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Comment
-
Tim Van Wassenhove
Re: How to close browser window in PHP?
In article <uy_rc.141$eK7. 1326235@news-text.cableinet. net>, Garp wrote:[color=blue]
><?php
> echo '<BUTTON onclick="window .close();">Clos e me.</BUTTON>';
> ?>
>
> Hey, it's PHP. ;-)[/color]
Depends, if you feed a webbrowser the
<?php echo 'foo'; ?>
it will not think it's php :P
--
Tim Van Wassenhove <http://home.mysth.be/~timvw/contact.php>
Comment
-
RonS
Re: How to close browser window in PHP?
Tim Van Wassenhove wrote:[color=blue]
> PHP is executed at the server-side and thus does not know about clients,
> browsers or windows of those browsers.
>
> With JavaScript you might have access to call window.close on windows
> you opened with the window.open function.
>
> Why would you want to close someone's window anyway? Most people don't
> like silly webdesigners trying to mess with their windows anyway.[/color]
Thanks for being so civil. Yes, I know about the Javascript and how PHP works.
And I know how frustrated some people get with seemingly obvious questions
I've got an app that displays a months worth of data from a database in a
window. When the user clicks on an entry in this window I open a separate small
editing window for just that days data. I know I can have a separate button for
the user to close the window with Javascript (which is the way it works now),
but would rather have the window 'automatically' close when the user submits the
changes.
In semi-pseudo code, I envisioned something like this:
// Code to check for updated variables after a submit
....
$blnDataChanged = TRUE;
if ($blnDataChange d) {
// Store hours and close window
...
//Redirect back to (and refresh) the data display window
exit;
}
Comment
-
Theo
Re: How to close browser window in PHP?
"Garp" <garp7@no7.blue yonder.co.uk> wrote in news:uy_rc.141$ eK7.1326235
@news-text.cableinet. net:
[color=blue]
> Hey, it's PHP. ;-)
>[/color]
hehe, 'A' for effort
Comment
-
Theo
Re: How to close browser window in PHP?
RonS <ronsteinerNO@S PAMtds.net> wrote in
news:40b0d3b8$1 _1@newspeer2.td s.net:
[color=blue]
> I've got an app that displays a months worth of data from a database
> in a window. When the user clicks on an entry in this window I open a
> separate small editing window for just that days data. I know I can
> have a separate button for the user to close the window with
> Javascript (which is the way it works now), but would rather have the
> window 'automatically' close when the user submits the changes.[/color]
thats still javascript. in the 'action' part of the form, put the close
statement.
action="javascr ipt::window.clo se()"
(I think I got that right)
Comment
-
Martin Geisler
Re: How to close browser window in PHP?
RonS <ronsteinerNO@S PAMtds.net> writes:
[color=blue]
> I've got an app that displays a months worth of data from a database
> in a window. When the user clicks on an entry in this window I open
> a separate small editing window for just that days data. I know I
> can have a separate button for the user to close the window with
> Javascript (which is the way it works now), but would rather have
> the window 'automatically' close when the user submits the changes.[/color]
Instead of trying to solve this on the server-side (where it is
impossible or at least rather difficult) couldn't you have PHP
generate JavaScript the page shown in the main window, and then when
the user submits the data, this JavaScript will check for changes.
The sub window could then be closed by this JavaScript code.
--
Martin Geisler My GnuPG Key: 0xF7F6B57B
PHP EXIF Library | PhpWeather | PhpShell
http://pel.sf.net/ | http://phpweather.net/ | http://gimpster.com/
Read/write EXIF data | Show current weather | A shell in a browser
Comment
-
RonS
Re: How to close browser window in PHP?
Martin Geisler wrote:[color=blue]
> RonS <ronsteinerNO@S PAMtds.net> writes:
>
>[color=green]
>>I've got an app that displays a months worth of data from a database
>>in a window. When the user clicks on an entry in this window I open
>>a separate small editing window for just that days data. I know I
>>can have a separate button for the user to close the window with
>>Javascript (which is the way it works now), but would rather have
>>the window 'automatically' close when the user submits the changes.[/color]
>
>
> Instead of trying to solve this on the server-side (where it is
> impossible or at least rather difficult) couldn't you have PHP
> generate JavaScript the page shown in the main window, and then when
> the user submits the data, this JavaScript will check for changes.
> The sub window could then be closed by this JavaScript code.[/color]
Martin ... of course that's it! As usual, it's very simple once you see it. I
just couldn't seem to come up with this. I had never closed a window other than
the current window in Javascript before now.
Thanks so much.
Ron
Comment
Comment