views:

26

answers:

1

I have the following code

Response.TransmitFile(filePath);

Opens the new window using the following line of code

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", downloadURL), true);

This works on IE8 however doesn't work on IE6 and IE7

anyidea what might be wrong here?

A: 

You'll most likely get a script error

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", "http://example.com"), true);

should render the javascript:

window.open('http://example.com', target = 'new');

In the above script, the target variable is undefined. If you wanted the link to open in a new window, try:

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', '_blank');", downloadURL), true);

Look here for a list of the available parameters to the window.open function

nxt
how about IE6 and IE7?
Kalls