Web API1 - is there a way to download a file w/o the browser opening up a new tab each time?

Hello All,

I am currently using Web API1 - is there a way to download a file without the browser opening up a new tab each time?

I’ve tried several things including setting wf.ForceDownload = false, but that only kills the session by displaying the pdf on the same tab.

Tim

dim fTmp as FolderItem = GetTemporaryFolderItem
RunPDFReport("Report.pdf", m_oDoc, fTmp)
if fTmp = nil then Return

wf = WebFile.open(fTmp)
wf.Filename =  ReportNme + ".pdf"   //"Report.pdf"
wf.MIMEType = "application/pdf"
wf.ForceDownload = true //Needs to be true so it doesn't open it in the same browser window (thus killing the session).
// To open a new tab and display the  pdf file do this:
// showURL wf.url


// Added  062023d version
If wf.Download Then // This causes the file to be downloaded
  Dim F1 As New FolderItem("C:\Temp\" + ReportNme + ".pdf")  //  Set a location to save the file
  Dim f As FolderItem = New FolderItem(fTmp)  
  If f <> Nil And f.Exists Then
    F.CopyFileTo(f1)
  End If
End If

I’m using Web 2, and for what it’s worth this doesn’t force a new tab or window…

// Showing the URL prompts the browser to download it
Session.GoToURL(Session.TheWebFile.URL)

New tab?

If you are talking about the browser openning the downloaded PDF, that is something in your browser prefferences, not the Web App.

Yes, I know that. I was looking to download independent of the browser. Guess that’s not possible.
Tim