views:

1135

answers:

3

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.

+7  A: 

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
Ah, sorry. Mentioned your answer, but forgot to vote. +1
Cerebrus
+5  A: 

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
+1  A: 

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