S
S
Sweet Cookies2018-10-31 13:54:21
JavaScript
Sweet Cookies, 2018-10-31 13:54:21

How to return focus to the parent window - window.open?

There is a simple window.open function:

function preview() {
 var newWin = window.open('/preview.html', 'example', 'width=600,height=400');
//onfocus/onblur
}
preview();

Task: return focus to the parent window without closing the popup! Presumably onfocus/onblur, but can't use them? Chrome browser.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eyeless_watcher, 2018-10-31
@eyeless_watcher

onfocus/onblur are events for subscribing to get/lose focus. The method itself is window.focus();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question