Is it possible to open an alert message over another window? I do a window.open() then I show an alert message. But that alert message brings me back to the window containing the javascript that displayed the message. This behavior makes sense. But I want to display help message for the new window that is currently being shown to the user. Is there a way to get that functionality with alert() or is there a different way to do that?
window.open(url, _blank);
alert('Do step 1, then step 2, then step 3 to get to the page');
// The step above returns the focus to the original window
Is there a way around that?
** EDIT **
Got the answer from Musa but had to modify it because I was using setTimeout and ran into browser suppression issues. Normally, his answer should work. Here is the code that worked.
external_window = window.open(url,'_blank'); // Open external window.
message_window = window.open (url,'_blank','width=600,height=200,top=200,left=300'); // Open message window.
self.focus(); // Keep focus on original window.
setTimeout(function() { external_window.focus(); message_window.focus(); }, 4000); // After delay, focus on external window, then on message window
This has the right effect while getting around the browser suppression issue.
1 Answer