You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Fixed some format problems with the description (list of schemes are not showing on separate lines)
- One example used a very old, classic Mac OS style file path
- Added examples using URL as destination rather than source, including need to textEncode and textDecode when reading and writing to external files.
- Added file system tag, since URL can be used to read/write from local file system
Copy file name to clipboardExpand all lines: docs/dictionary/keyword/URL.lcdoc
+25-4Lines changed: 25 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -18,23 +18,44 @@ Example:
18
18
get URL "http://www.xworlds.com/index.html"
19
19
20
20
Example:
21
-
put URL "binfile:/Mac HD/Files/example.gif" into image "Example Logo"
21
+
put URL "binfile:/Users/myuser/Files/example.gif" into image "Example Logo"
22
22
23
23
Example:
24
24
post field "Results" to URL "http://www.example.org/current.txt"
25
25
26
26
Example:
27
27
get URL "http://www.xworlds.com/index.html"
28
28
29
+
Example:
30
+
put "Hello World" into URL "file:/Users/myuser/Documents/sample.txt"
31
+
32
+
Example:
33
+
# Writing the contents of a field to an external file, preserving text encoding
34
+
on textSave
35
+
put "всем привет" into field "russiantext"
36
+
put textEncode(field "russiantext","UTF-8") into "binfile:/Users/myuser/Documents/russtext.txt"
37
+
end textSave
38
+
# Reading contents of a file into LiveCode, preserving text encoding
39
+
on textRead
40
+
local tText
41
+
put URL "binfile:/Users/myuser/Documents/russtext.txt" into tText
42
+
put textDecode(tText,"UTF-8") into field "russiantext"
43
+
end textRead
44
+
29
45
Description:
30
46
Use the <URL> <keyword> to access the contents of a local <file> or a <file> accessible on the Web.
31
47
32
-
A <URL> is a method of designating a file or other resource. You can use a <URL> like any other container. You can get the contents of a <URL> or use its contents in any expression. LiveCode supports the following <URL> schemes:
48
+
A <URL> is a method of designating a file or other resource. You can use a <URL> like any other container.
49
+
You can get the contents of a <URL> or use its contents in any expression. LiveCode supports the following <URL> schemes:
33
50
34
51
http: a page from a web server
52
+
35
53
ftp: a directory or file on an FTP server
36
-
<file> : a text file on the local disk (not on a server)
54
+
55
+
<file>: a text file on the local disk (not on a server)
56
+
37
57
binfile: a binary file
58
+
38
59
resfile: on Mac OS and OS X systems, the resource fork of a file
39
60
40
61
All actions that refer to a <URL> container are blocking: that is, the handler pauses until LiveCode is finished accessing the <URL>. Since fetching a web page may take some time due to network lag, accessing URLs may take long enough to be noticeable to the user. To avoid this delay, use the load command (which is non-blocking) to cache web pages before you need them.
@@ -49,4 +70,4 @@ From LiveCode 7.0.0, URL keyword has been upgraded to understand Unicode files w
0 commit comments