JSFiddle - React, Tailwind, and code Playground
by shivaay123
HTML
<!DOCTYPE html>
<html>
<head>
<title>
javascript window Blur and Focus method
</title>
</head>
<body>
<h2>Blur and Focus</h2>
<script>
var Tab;
function wOpen() {
Tab = window.open(
"https://javascript.info/",
"_blank", "width=300, height=200");
}
function wClose() {
Tab.close();
}
function wBlur() {
Tab.blur();
}
function wFocus() {
Tab.focus();
}
</script>
<button onclick="wOpen()">
Open Webpage
</button>
<button onclick="wBlur()">
Blur Webpage
</button>
<button onclick="wFocus()">
Focus Webpage
</button>
<button onclick="wClose()">
Close webpage
</button>
</body>
</html>