SVG Window.closed Property
Last Updated :
30 Mar, 2022
The SVG Window.closed property indicates whether the referenced window is closed or not.
Syntax:
const isClosed = windowRef.closed
Return value: This property returns the boolean value of the event element.
Example 1: In this example, we will use onclick event.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 1000 1000"
< circle cx = "50" cy = "50" r = "50"
onclick = "check()" />
< script type = "text/javascript" >
function check() {
document.write(
"This Window is closed : ",
window.closed);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 2: In this example, we will use onclick event.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 1000 1000"
< text x = "50" y = "20" font-size = "20px"
onclick = "check()" >
GeeksForGeeks
</ text >
< script type = "text/javascript" >
function check() {
document.write(
"This Window is closed : ",
window.closed);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 3: In this example, we will use onmouseover event.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 1000 1000"
< circle cx = "50" cy = "50" r = "50"
onmouseover = "check()" />
< script type = "text/javascript" >
function check() {
document.write(
"This Window is closed : ",
window.closed);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 4: In this example, we will use onmouseover event.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 1000 1000"
< text x = "50" y = "20" font-size = "20px"
onmouseover = "check(event)" >
GeeksForGeeks
</ text >
< script type = "text/javascript" >
function check() {
document.write(
"This Window is closed : ",
window.closed);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...