4

I am developing web applications with c#, Aspnet 3.5, and Ajax 2.0.

Question - I run Application_1 in ie7. I would like to programmatically start running Application_2 from Application_1 in a new tab, no matter what the client settings are.

Until now I have been opening Application_2 in a new window from Application_1 using

ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "window.open('theurl',' width=800, height=500'); ", true);

I would like to do something similar to open a new tab.

Cerebrus
  • 25,615
  • 8
  • 56
  • 70
  • However... System.Diagnostics.Process.Start("http://www.youtube.com") will use an existing Internet browser and open in new tab if supported. on the other hand: System.Diagnostics.Process.Start("iexplore","http://www.youtube.com") this will open a new instance of iexplore – Sam Saarian Oct 02 '12 at 05:43

3 Answers3

8

Unfortunately there is no way to control whether the window opens in a new tab or new window. This is a user setting that can't be overridden in code.

Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
5

Here is Microsoft's justification if you're interested.

"Regarding script, there is no "target='_tab'" feature or any direct access to tabs from script beyond what is available with multiple windows today. We are working on balancing the default behavior for whether a window opened from script opens as in a new frame or a tab."

You could inform your user that by holding ctrl+shift and clicking a link will open in a new tab.

Jesse Dearing
  • 2,251
  • 18
  • 20
1

As Paul already noted, this cannot be done via any script or code.

I think it's best to let your users decide (via their individual browser settings) how they want to open the new page - in a new window or in a new tab in the same window.

Cerebrus
  • 25,615
  • 8
  • 56
  • 70