http | |||||||
Type | keyword | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Associations | internet library | ||||||
Summary | Used as a URL type with such commands as put and get to designate a file on the World Wide Web. | ||||||
Introduced | 1.0 | ||||||
Changes | The http keyword was moved to the Internet library in version 1.1. In previous versions, this functionality was part of the engine. | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, server, mobile | ||||||
Example |
| ||||||
Values |
| ||||||
Related | Message: startup, openBackground, preOpenStack, openStack, preOpenCard Library: Internet library, library Keyword: URL, file, ftp, button, word, http Control Structure: function Function: libURLLastRHHeaders, result, files, libURLErrorData, value Command: post, libURLSetStatusCallback, put, load, group, delete URL, get, libURLSetCustomHTTPHeaders Glossary: LiveCode custom library, application, standalone application, evaluate, server, blocking, cache, statement, URL, command, container, expression, main stack, keyword, Standalone Application Settings, upload, download, message, flag, handler | ||||||
Security | network | ||||||
Description | Use the http keyword to work with files on the Web. The URL scheme "http" indicates information located on a web server. An http URL consists of:
Here are some examples of valid http URLs:
www.example.com
An http URL is a container, and you can use the expression URL httpURL in any statement where any other container type is used. When you get the value of an http URL, LiveCode downloads the URL from the server. (If you have previously cached the URL with the load command, it fetches the URL from the cache.) You can upload data to a web server by putting a value into an http URL, as in the following statement :
However, because most web servers do not allow HTTP uploads, the attempt usually will not be successful. (Check with the server's administrator to find out how and where to upload files.)
The following example shows how to set a flag in a global variable to prevent multiple downloads. The variable "gDownloadInProgress" is set to true while a download is going on, and back to false when the download concludes. If the user clicks the button again while the download is still going on, the handler simply beeps:
For technical information about URLs and the http URL scheme, see RFC 1630.
*Cross-platform note:* On iOS and Android, you can use the http keyword without the need for the Internet library. When specifying URLs for iOS and Android, you must use the appropriate form that conforms to RFC 1630. | ||||||
Tags | networking |