IE gets focus on iframe location change
-
09-10-2019 - |
Question
There is a third-party page with my iframe. I want to open a new window from iframe then change iframe location to other and focus to new window.
user_clicks = function() {
newwindow = window.open(new_window_url, "_blank");
newwindow.focus();
location.href = iframe_url;
}
It works in all browsers but not in IE. It returns focus back to page with iframe, when iframe location is changed.
Solution
Found the solution myself Placed blur on the second iframe url
setTimeout(function() {
parent.blur();
}, 1000);
Worked with setTimeout only, because without - it only blinks at one moment and returned back to page with iframe.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow