0

J'ai le code suivanttélécharger le fichier Javascript ne fonctionne pas sur IE6 et IE7

Response.TransmitFile(filePath); 

Ouvre la nouvelle fenêtre en utilisant la ligne de code suivante

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

Cela fonctionne sur IE8 cependant ne fonctionne pas sur IE6 et IE7

anyidea ce qui pourrait être mauvais ici?

+1

Quelles commandes JavaScript ont-ils favorisé? –

+0

window.open et la fenêtre se ferme. donc je n'ai pas le javascript. – kalls

Répondre

0

Vous aurez très probablement obtenir une erreur de script

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

devrait rendre le javascript:

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

Dans le script ci-dessus, la variable cible est définie. Si vous voulez que le lien pour ouvrir dans une nouvelle fenêtre, essayez:

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

Rechercher here pour obtenir une liste des paramètres disponibles à la fonction window.open

+0

que diriez-vous IE6 et IE7? – kalls