I have been tasked with emulating a JavaScript alert without using a JavaScript alert. I also cannot use jQuery in this app. So far, I have JavaScript that opens a new window using window.open
. When the user blurs away from the popup window I'm creating and then some new data loads in it, I need the window to focus again for the user. This works fine in IE, Chrome, and Firefox on this static HTML page; however, when I try the same thing from our ASP.NET application, it only works in IE. The window updates as expected, but it never refocuses for the user in other browsers.
Here's the code I use to re-focus the window:
window.onload = function() {
window.focus();
};
To open the window initially from the ASP.NET app, I'm using:
ClientScriptManager.RegisterClientScriptBlock(GetType(), "OurWindow", "OpenTheWindow();", true)
I've tried lots of what's already out there (such as these) to no avail. Am I missing something?
Edit: I added a little location.reload();
to the first page to simulate a postback from ASP.NET, but that didn't change anything.