I have opened a website in a browser tab. Now, when I open a new tab from this website, I want to close the first tab in that browser.
A:
You cannot use PHP to close a window but you can use this script
<script language="javascript" type="text/javascript">
function closeWindow() {
window.open('','_parent','');
window.close();
}
</script>
Graphain
2010-07-07 05:57:21
+2
A:
Hi,
Use this script
<script language="javascript">
function click1()
{
window.open("http://127.0.0.1/");
window.open("http://127.0.0.1/wordpress/?page_id=2");
}
function close1()
{
var c="http://127.0.0.1/";
c.close();
}
</script>
<input type="button" value="close me!!" onClick="close1()"/>-->
<html>
<head>
<script type="text/javascript">
function newwin (urllink) {
newwindow = window.open( urllink ,'newwin')
}
</script>
</head>
<body>
<a href="javascript:newwin('http://www.bbc.co.uk')">bbc</a><br>
<a href="javascript:newwin('http://www.google.co.uk')">google</a>
<form>
<input type="button" value="Close" onClick="window.newwindow.close()">
<form>
</body>
</html>
Kanak Vaghela
2010-07-07 05:59:30
Learn how to format code - just select it and click the editor image with the 010101.
Oded
2010-07-07 06:02:01
On the `close1` function, `c.close` will not work, `c` is simply a string...
CMS
2010-07-07 06:02:56
+1
A:
Hello,
I have this type of script. so try it. i hope it will help for you.
http://www.gtalbot.org/BrowserBugsSection/MSIE6Bugs/ClosingWindowsNotOpenedByJS.html
Thanks
How is this the correct answer to the question? How do you know when a user opened a new tab?
Konerak
2010-07-08 06:20:43
A:
Hello, Please try this
<script type="text/javascript">
function newwin (urllink) {
newwindow = window.open( urllink ,'newwin')
}
</script>
Kanji
2010-07-08 05:28:51