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'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 ( & ajax)
  • How to access a JavaScript variable from code behind in
  • 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 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#?
  • 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:


    As applies to your code:

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