
Close window which opened another window
Publicado por party (4 intervenciones) el 31/05/2024 21:51:15
Dear experts
I have the following code and I need that the button close the window, however this not work.
According to mentioned Developer site only the window which opened another window can close this.
https://developer.mozilla.org/en-US/docs/Web/API/Window/close
I have the following code and I need that the button close the window, however this not work.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<a href="/index.html">MI Pagina</a>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script language="javascript" type="text/javascript">
function windowClose() {
window.open('','_parent','');
window.close();
}
</script>
</head>
<BODY style="background-color:rgb(247, 247, 247)">
<h3>Haga clic en el siguiente botón para cerrar el navegador!</h3>
<!-- <input type="submit" value="Cerrar" onclick="javascript:window.close()"> -->
<input type="button" value="Cerrar la ventana" onclick="windowClose();">
</body>
</html>
According to mentioned Developer site only the window which opened another window can close this.
https://developer.mozilla.org/en-US/docs/Web/API/Window/close
Valora esta pregunta


0