Page 1 of 1
Is there a way to close a window behind you?
Posted: Fri Jul 26, 2002 8:17 pm
by virgil
Is there a way to close a window behind you? If not, is there a way to <href> back to a window that is already open without opening a new window?
Thanks Virgil

Posted: Fri Jul 26, 2002 9:15 pm
by volka
client-side, isn't it?
There is a function window.close(); but if the window has a history (that means: the user browsed within this window several pages) a confirmation box pops up.
You may reuse a window like you do with frames i.e. <a href="..." target="myWindow">
Posted: Fri Jul 26, 2002 10:05 pm
by hob_goblin
correction: a confirmation box pops up if the window was not opened with javascript
Posted: Fri Jul 26, 2002 10:23 pm
by virgil
Hi
I think I'm close.
I have a search page in window "A"
It sends and displays the results in a frameset in window "B"
I trying to get back to window "A"
This link on the results page, closes window "B"
Code: Select all
echo "<a href='search_page.php' target='_parent'>Return to Search</a><BR><BR><BR>";
But it opens the search page again in a new window "C" instead of reusing window "A"
My question: Is there a way to use the "_parent" attrubute with a window name target like stated in Volka's post?
And in what tag do you assign the NAME="..." to for a regular window(not a frame)? i.e.
Code: Select all
<frame NAME="main">// for a frame
<where? NAME="window">//for a non frame page
Thanks again
Posted: Thu Sep 05, 2002 7:25 pm
by Stoyanski
Windows can only can be NAME-d if are opened with window.open() function, so you can reuse them.
Posted: Wed Sep 25, 2002 6:48 am
by Bjai
You can try the following code if you use IE, this closes the browser windows EVEN it is not opened by js.
Code: Select all
<OBJECT ID="WB" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>
<SCRIPT>WB.ExecWB(45,2);</SCRIPT>
Posted: Wed Sep 25, 2002 6:57 am
by Bjai
btw, just in case somebody may ask why that confirmation if you want to window.close() the parent browser. I think it's because for security reasons (albeit not a very good one), it stops websites that load some malicious code into your computer with this method and then closes itself, and all this done without you knowing.... but I guess with my previous code snippet you can now try it out with IE

Posted: Wed Sep 25, 2002 7:26 pm
by virgil
Hi PHP's
Your code works great!
Code: Select all
$post_text_area= str_replace($badwords_array, '%*$#@!', $post_text_area);
$count=substr_count($post_text_area, '%*$#@!');
if($count>0){$count_total=$count_total+$count;
}
if($count_total > 5){echo "<OBJECT ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></OBJECT>
<SCRIPT>WB.ExecWB(45,2);</SCRIPT>";
}
Slams jerks right off the site!
Thanks for the code!
Virgil