From Xojo Documentation

Revision as of 17:38, 2 September 2020 by Gperlman (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Boolean )
aWebFile.ForceDownload = newBooleanValue
BooleanValue = aWebFile.ForceDownload

New in 2010r5

Supported for all project types and targets.

Indicates whether the browser will always download the file instead of trying to display it (depending on the MIMEType). The default is False.


When True, the browser will always download the file rather than try to display it. For example, most web browsers will try to display simple text files and many will display PDF files inline. Set ForceDownload to True to instead ensure these types of files are downloaded instead.

If you find that FireFox users can't download files, try using WebSession.GotoURL and pass True for the InNewWindow parameter as well as having the user disable popup blockers.


Create a new file for downloading:

TextFile = New WebFile // TextFile is a property of the web page
TextFile.MimeType = "text/plain"
TextFile.ForceDownload = True // If False, the browser may try to display the file instead of download it
TextFile.FileName = "TextFile.txt"

TextFile.Data = "Hello, world!"

ShowURL(TextFile.URL) // This causes the file to be downloaded