This demo retains the original popup-window exercise. Modern browsers may ignore requests to change another window’s focus, so the buttons demonstrate the API without assuming the browser will honor every request.
Checking focus status…
let childWindow = null;
childWindow = window.open('moveby-child.htm', 'Rating', 'width=250,height=150');
if (childWindow && !childWindow.closed) {
childWindow.focus();
}
const focused = document.hasFocus();
The old window.blur() call is retained only for historical comparison; browsers may ignore it.