Hallo!
I am looking for the way to close the browser-window.
In Javascript you can use a button and: onClick="self.close();"
how can I do that with PHP? I do not know how to adress the window-objects...
Thanks for help in advance,
Connie
Hallo!
I am looking for the way to close the browser-window.
In Javascript you can use a button and: onClick="self.close();"
how can I do that with PHP? I do not know how to adress the window-objects...
Thanks for help in advance,
Connie
It is not possible, PHP is a server software, not a client.
Simply do:
echo "<a href=javascript:onClick="self.close();">\n";
This pretty much places the javascript in your html...of course tweak the js because I suck at js
echo "<a href='javascript:onClick=\"window.close();\"'>\n";
That's properly escaped and tweaked. Note the change from self to window - that ensures that the window is being addressed, as opposed to other things...
-Sado
You don't even have to put it in an <a...> tag.
Just...
<script language="Javascript1.1">
window.close();
</script>
...and then have your php code print it in order to (hopefully) close the browser down.
Probably redundant, but I figured I'd mention it.
--Robert
Thanks, Jim, and all others, who answered!
I wanted to get rid of the JS at all...
I dont want to write the JS and the <noscript>...</noscript> stuff
so I see it is not possible, I did not realise that a server-side 'process' can't manage the 'client side'...
in german we say: zu kurz gedacht = thought too shortly....;-)
thanks again, this is a great place here,
Connie
http://www.avantart.com
No problem Connie...and I thank everybody who built on my comment and fixed/tweaked my line as well. Thanks folks.
-Jim
Hi
this was really helpful
But my problem is that this page on which i can put this javascript for closing the browser is a part of the entire page
That is its a frame
There are like 3 frames on the page
And this page on which this text would appear is one of the frame.
But when i want to close the browser, i want the entire webpage to close and it is not working this way
It works with just one frame but with multiple frames on a page it doesn't work.
Is there a way out ?
Thanks in advance
I believe if you change 'window' to 'parent' it will work but I haven't tested it:
<script language="Javascript1.1">
parent.close();
</script>
Check me ...
~S
to be sure use "top" so no other frame is above...
<script>top.close()</script>
greetings,
absyss