Javascript Popup Browser Tab Will Not Gain Focus

I’m using this bit of javascript in a .NET 4.0 web application for IE8:

ClientScript.RegisterStartupScript(this.Page.GetType(), "popupOpener", "var popup=window.open('Report.aspx');popup.focus();", true);

This opens an .aspx page in a new browser tab.

  • how to render a user the local-time using a UTC Time (asp.net & ajax)
  • How to access a JavaScript variable from code behind in asp.net
  • Disable ASP.NET validators with JavaScript
  • Access C# Variable From JavaScript
  • Javascript confirm message problem
  • Google map divided in regions with color and in subregions
  • However, it does not give the tab focus, which I would very much like to do. Does anyone know how to achieve this?

  • JQuery/Javascript: Client side modification of asp.net datagrid output to allow tablesorter to work
  • How to make a simple yes/no popup in ASP.NET that return the result back to my c#?
  • asp.net usercontrol won't fire javascript inside updatepanel
  • How to set a C# variable value from javascript
  • ChatJS how can I only have private chat without room?
  • XDomainRequest - not calling…not doing anything
  • One Solution collect form web for “Javascript Popup Browser Tab Will Not Gain Focus”

    Not all browsers support focus, and I believe there are some bugs even among those that do.

    Try to blur the window before giving it focus. It’s bizarre but has worked for folks in the past.

    In general:

    popup_handle.blur();
    popup_handle.focus();
    

    As applies to your code:

    ClientScript.RegisterStartupScript(this.Page.GetType(), "popupOpener", "var popup=window.open('Report.aspx');popup.blur();popup.focus();", true);