Ciao ragazzo non sapevo se postare qua o su Js ma penso che qua ci siano più possibilità di risolvere, magari anche cambiando sistema.
Tramite al funzione trovata qui sul forum forzo un download di un file.
Codice PHP:
Private Sub DownloadFile(file)
'--declare variables
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
'-- set absolute file location
strAbsFile = Server.MapPath(file)
'-- create FSO object to check if file exists and get properties
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'-- check to see if the file exists
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
'-- first clear the response, and then set the appropriate headers
Response.Clear
'-- the filename you give it will be the one that is shown
' to the users by default when they save
Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
Response.CharSet = "UTF-8"
'-- load into the stream the file
objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
End If
Set objFSO = Nothing
End Sub
Praticamente faccio così, estraggo dei record dai db, presento una tabella con tutti i file cercati
e viene fuori una serie di link tipo
download
download
download
cliccando lancio una funzione js window.open con id relativo, su una pagina ASP, con la funzione di prima.
Il problema è che gli header di questa pagina li mette la funzione stessa, e se sulla finestra faccio "Salva con nome" (o Apri) la finestra rimane bianca e non importa quello che altro ci scriva dentro, sia testo che codice Js. Questo con IE 6.0
Con FF mi si chiude da sola.
Come potrei rimediare?