Artifact
c1a81de04ac7916c862465e562d5072dcf7d6f58:
Wiki page
[(system webview)] by
murphy
2018-02-03 00:16:13.
0000: 44 20 32 30 31 38 2d 30 32 2d 30 33 54 30 30 3a D 2018-02-03T00:
0010: 31 36 3a 31 33 2e 39 32 34 0a 4c 20 28 73 79 73 16:13.924.L (sys
0020: 74 65 6d 5c 73 77 65 62 76 69 65 77 29 0a 50 20 tem\swebview).P
0030: 32 36 36 36 37 38 32 33 34 33 31 38 61 33 61 64 266678234318a3ad
0040: 65 62 31 32 39 63 35 37 32 63 36 64 65 62 33 39 eb129c572c6deb39
0050: 36 37 62 37 65 37 62 61 0a 55 20 6d 75 72 70 68 67b7e7ba.U murph
0060: 79 0a 57 20 32 39 35 32 0a 3c 68 31 3e 57 65 62 y.W 2952.<h1>Web
0070: 76 69 65 77 20 42 69 6e 64 69 6e 67 73 3c 2f 68 view Bindings</h
0080: 31 3e 0d 0a 0d 0a 3c 63 6f 64 65 3e 28 69 6d 70 1>....<code>(imp
0090: 6f 72 74 20 28 73 79 73 74 65 6d 20 77 65 62 76 ort (system webv
00a0: 69 65 77 29 29 3c 2f 63 6f 64 65 3e 0d 0a 0d 0a iew))</code>....
00b0: 42 69 6e 64 69 6e 67 73 20 74 6f 20 61 20 6d 6f Bindings to a mo
00c0: 64 69 66 69 65 64 20 76 65 72 73 69 6f 6e 20 6f dified version o
00d0: 66 20 74 68 65 20 5b 68 74 74 70 73 3a 2f 2f 67 f the [https://g
00e0: 69 74 68 75 62 2e 63 6f 6d 2f 7a 73 65 72 67 65 ithub.com/zserge
00f0: 2f 77 65 62 76 69 65 77 7c 77 65 62 76 69 65 77 /webview|webview
0100: 5d 20 6c 69 62 72 61 72 79 2e 0d 0a 0d 0a 3c 68 ] library.....<h
0110: 32 3e 4d 61 69 6e 20 49 6e 74 65 72 66 61 63 65 2>Main Interface
0120: 3c 2f 68 32 3e 0d 0a 0d 0a 3c 68 33 3e 70 72 6f </h2>....<h3>pro
0130: 63 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28 77 cedure: <code>(w
0140: 65 62 76 69 65 77 20 3c 69 3e 74 69 74 6c 65 3c ebview <i>title<
0150: 2f 69 3e 20 3c 69 3e 75 72 6c 3c 2f 69 3e 20 3c /i> <i>url</i> <
0160: 69 3e 6f 6e 2d 65 78 74 65 72 6e 61 6c 2d 69 6e i>on-external-in
0170: 76 6f 6b 65 3c 2f 69 3e 20 3c 69 3e 6f 70 74 69 voke</i> <i>opti
0180: 6f 6e 3c 2f 69 3e 20 2e 2e 2e 29 3c 2f 63 6f 64 on</i> ...)</cod
0190: 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 4c 61 75 6e 63 e></h3>....Launc
01a0: 68 20 61 20 77 65 62 76 69 65 77 20 77 69 74 68 h a webview with
01b0: 20 74 68 65 20 67 69 76 65 6e 20 74 69 74 6c 65 the given title
01c0: 2c 20 55 52 4c 2c 20 65 78 74 65 72 6e 61 6c 20 , URL, external
01d0: 69 6e 76 6f 63 61 74 69 6f 6e 20 63 61 6c 6c 62 invocation callb
01e0: 61 63 6b 20 61 6e 64 20 70 6f 73 73 69 62 6c 79 ack and possibly
01f0: 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 66 additional conf
0200: 69 67 75 72 61 74 69 6f 6e 20 6f 70 74 69 6f 6e iguration option
0210: 73 2e 0d 0a 0d 0a 54 68 65 20 65 78 74 65 72 6e s.....The extern
0220: 61 6c 20 69 6e 76 6f 63 61 74 69 6f 6e 20 63 61 al invocation ca
0230: 6c 6c 62 61 63 6b 20 72 65 63 65 69 76 65 73 20 llback receives
0240: 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a 20 54 two arguments: T
0250: 68 65 20 77 65 62 76 69 65 77 20 61 6e 64 20 61 he webview and a
0260: 20 73 74 72 69 6e 67 2e 20 54 68 65 20 73 74 72 string. The str
0270: 69 6e 67 20 61 72 67 75 6d 65 6e 74 20 69 73 20 ing argument is
0280: 70 72 6f 76 69 64 65 64 20 62 79 20 4a 61 76 61 provided by Java
0290: 53 63 72 69 70 74 20 6f 6e 20 74 68 65 20 70 61 Script on the pa
02a0: 67 65 20 75 73 69 6e 67 20 61 20 63 61 6c 6c 20 ge using a call
02b0: 74 6f 20 3c 74 74 3e 77 69 6e 64 6f 77 2e 65 78 to <tt>window.ex
02c0: 74 65 72 6e 61 6c 2e 69 6e 76 6f 6b 65 3c 2f 74 ternal.invoke</t
02d0: 74 3e 2e 0d 0a 0d 0a 42 6f 74 68 20 74 68 65 20 t>.....Both the
02e0: 55 52 4c 20 61 6e 64 20 63 61 6c 6c 62 61 63 6b URL and callback
02f0: 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 62 procedure may b
0300: 65 20 3c 74 74 3e 23 66 3c 2f 74 74 3e 2e 20 49 e <tt>#f</tt>. I
0310: 66 20 6e 6f 20 55 52 4c 20 69 73 20 70 61 73 73 f no URL is pass
0320: 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 64 65 66 ed, an empty def
0330: 61 75 6c 74 20 70 61 67 65 20 69 73 20 75 73 65 ault page is use
0340: 64 20 74 68 61 74 20 63 61 6c 6c 73 20 3c 74 74 d that calls <tt
0350: 3e 77 69 6e 64 6f 77 2e 65 78 74 65 72 6e 61 6c >window.external
0360: 2e 69 6e 76 6f 6b 65 28 22 6c 6f 61 64 22 29 3c .invoke("load")<
0370: 2f 74 74 3e 20 6f 6e 63 65 20 77 68 65 6e 20 6c /tt> once when l
0380: 6f 61 64 65 64 2e 20 49 66 20 6e 6f 20 63 61 6c oaded. If no cal
0390: 6c 62 61 63 6b 20 70 72 6f 63 65 64 75 72 65 20 lback procedure
03a0: 69 73 20 70 61 73 73 65 64 2c 0d 0a 20 3c 74 74 is passed,.. <tt
03b0: 3e 77 69 6e 64 6f 77 2e 65 78 74 65 72 6e 61 6c >window.external
03c0: 2e 69 6e 76 6f 6b 65 3c 2f 74 74 3e 20 69 73 20 .invoke</tt> is
03d0: 61 76 61 69 6c 61 62 6c 65 20 62 75 74 20 64 6f available but do
03e0: 65 73 20 6e 6f 74 68 69 6e 67 2e 0d 0a 0d 0a 54 es nothing.....T
03f0: 68 65 20 6c 69 73 74 20 6f 66 20 61 64 64 69 74 he list of addit
0400: 69 6f 6e 61 6c 20 63 6f 6e 66 69 67 75 72 61 74 ional configurat
0410: 69 6f 6e 20 6f 70 74 69 6f 6e 73 20 6d 61 79 20 ion options may
0420: 63 6f 6e 74 61 69 6e 20 74 68 65 20 66 6f 6c 6c contain the foll
0430: 6f 77 69 6e 67 20 6b 65 79 73 3a 0d 0a 0d 0a 20 owing keys:....
0440: 20 2a 20 20 3c 74 74 3e 77 69 64 74 68 3c 2f 74 * <tt>width</t
0450: 74 3e 20 74 6f 20 73 70 65 63 69 66 79 20 77 69 t> to specify wi
0460: 6e 64 6f 77 20 77 69 64 74 68 0d 0a 20 20 2a 20 ndow width.. *
0470: 20 3c 74 74 3e 68 65 69 67 68 74 3c 2f 74 74 3e <tt>height</tt>
0480: 20 74 6f 20 73 70 65 63 69 66 79 20 77 69 6e 64 to specify wind
0490: 6f 77 20 68 65 69 67 68 74 0d 0a 20 20 2a 20 20 ow height.. *
04a0: 3c 74 74 3e 72 65 73 69 7a 61 62 6c 65 3f 3c 2f <tt>resizable?</
04b0: 74 74 3e 20 74 6f 20 73 70 65 63 69 66 79 20 77 tt> to specify w
04c0: 68 65 74 68 65 72 20 74 68 65 20 77 69 6e 64 6f hether the windo
04d0: 77 20 73 69 7a 65 20 6d 61 79 20 62 65 20 63 68 w size may be ch
04e0: 61 6e 67 65 64 0d 0a 20 20 2a 20 20 3c 74 74 3e anged.. * <tt>
04f0: 64 65 62 75 67 3f 3c 2f 74 74 3e 20 74 6f 20 73 debug?</tt> to s
0500: 70 65 63 69 66 79 20 77 68 65 74 68 65 72 20 64 pecify whether d
0510: 65 62 75 67 67 69 6e 67 20 74 6f 6f 6c 73 20 73 ebugging tools s
0520: 68 6f 75 6c 64 20 62 65 20 65 6e 61 62 6c 65 64 hould be enabled
0530: 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 ....<h3>procedur
0540: 65 3a 20 3c 63 6f 64 65 3e 28 77 65 62 76 69 65 e: <code>(webvie
0550: 77 2d 74 65 72 6d 69 6e 61 74 65 21 20 3c 69 3e w-terminate! <i>
0560: 77 65 62 76 69 65 77 3c 2f 69 3e 29 3c 2f 63 6f webview</i>)</co
0570: 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 41 73 6b 20 de></h3>....Ask
0580: 74 68 65 20 67 69 76 65 6e 20 77 65 62 76 69 65 the given webvie
0590: 77 20 74 6f 20 71 75 69 74 2e 0d 0a 0d 0a 3c 68 w to quit.....<h
05a0: 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 3>procedure: <co
05b0: 64 65 3e 28 77 65 62 76 69 65 77 2d 74 69 74 6c de>(webview-titl
05c0: 65 2d 73 65 74 21 20 3c 69 3e 77 65 62 76 69 65 e-set! <i>webvie
05d0: 77 3c 2f 69 3e 20 3c 69 3e 74 69 74 6c 65 3c 2f w</i> <i>title</
05e0: 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d i>)</code></h3>.
05f0: 0a 0d 0a 43 68 61 6e 67 65 20 74 68 65 20 74 69 ...Change the ti
0600: 74 6c 65 20 6f 66 20 74 68 65 20 67 69 76 65 6e tle of the given
0610: 20 77 65 62 76 69 65 77 2e 0d 0a 0d 0a 3c 68 33 webview.....<h3
0620: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 >procedure: <cod
0630: 65 3e 28 77 65 62 76 69 65 77 2d 66 75 6c 6c 73 e>(webview-fulls
0640: 63 72 65 65 6e 2d 73 65 74 21 20 3c 69 3e 77 65 creen-set! <i>we
0650: 62 76 69 65 77 3c 2f 69 3e 20 3c 69 3e 66 75 6c bview</i> <i>ful
0660: 6c 73 63 72 65 65 6e 3f 3c 2f 69 3e 29 3c 2f 63 lscreen?</i>)</c
0670: 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 43 68 61 ode></h3>....Cha
0680: 6e 67 65 20 74 68 65 20 66 75 6c 6c 73 63 72 65 nge the fullscre
0690: 65 6e 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 en state of the
06a0: 67 69 76 65 6e 20 77 65 62 76 69 65 77 2e 0d 0a given webview...
06b0: 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a ..<h3>procedure:
06c0: 20 3c 63 6f 64 65 3e 28 77 65 62 76 69 65 77 2d <code>(webview-
06d0: 63 6f 6c 6f 72 2d 73 65 74 21 20 3c 69 3e 77 65 color-set! <i>we
06e0: 62 76 69 65 77 3c 2f 69 3e 20 3c 69 3e 72 65 64 bview</i> <i>red
06f0: 3c 2f 69 3e 20 3c 69 3e 67 72 65 65 6e 3c 2f 69 </i> <i>green</i
0700: 3e 20 3c 69 3e 62 6c 75 65 3c 2f 69 3e 20 3c 69 > <i>blue</i> <i
0710: 3e 61 6c 70 68 61 3c 2f 69 3e 29 3c 2f 63 6f 64 >alpha</i>)</cod
0720: 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 43 68 61 6e 67 e></h3>....Chang
0730: 65 20 74 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 e the background
0740: 20 63 6f 6c 6f 72 20 6f 66 20 74 68 65 20 67 69 color of the gi
0750: 76 65 6e 20 77 65 62 76 69 65 77 2e 0d 0a 0d 0a ven webview.....
0760: 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c <h3>procedure: <
0770: 63 6f 64 65 3e 28 77 65 62 76 69 65 77 2d 65 76 code>(webview-ev
0780: 61 6c 20 3c 69 3e 77 65 62 76 69 65 77 3c 2f 69 al <i>webview</i
0790: 3e 20 3c 69 3e 63 6f 64 65 3c 2f 69 3e 29 3c 2f > <i>code</i>)</
07a0: 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 45 76 code></h3>....Ev
07b0: 61 6c 75 61 74 65 20 4a 61 76 61 53 63 72 69 70 aluate JavaScrip
07c0: 74 20 63 6f 64 65 20 69 6e 20 74 68 65 20 67 69 t code in the gi
07d0: 76 65 6e 20 77 65 62 76 69 65 77 2e 0d 0a 0d 0a ven webview.....
07e0: 3c 68 32 3e 44 69 61 6c 6f 67 20 49 6e 74 65 72 <h2>Dialog Inter
07f0: 66 61 63 65 3c 2f 68 32 3e 0d 0a 0d 0a 3c 68 33 face</h2>....<h3
0800: 3e 73 79 6e 74 61 78 3a 20 3c 63 6f 64 65 3e 28 >syntax: <code>(
0810: 64 69 61 6c 6f 67 2d 74 79 70 65 2d 66 6c 61 67 dialog-type-flag
0820: 20 3c 69 3e 73 79 6d 62 6f 6c 3c 2f 69 3e 29 3c <i>symbol</i>)<
0830: 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 /code></h3>..<h3
0840: 3e 73 79 6e 74 61 78 3a 20 3c 63 6f 64 65 3e 28 >syntax: <code>(
0850: 64 69 61 6c 6f 67 2d 74 79 70 65 20 3c 69 3e 73 dialog-type <i>s
0860: 79 6d 62 6f 6c 3c 2f 69 3e 20 2e 2e 2e 29 3c 2f ymbol</i> ...)</
0870: 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 54 68 code></h3>....Th
0880: 65 20 64 69 61 6c 6f 67 20 66 6c 61 67 73 20 65 e dialog flags e
0890: 6e 75 6d 65 72 61 74 69 6f 6e 20 69 73 20 75 73 numeration is us
08a0: 65 64 20 74 6f 20 69 6e 64 69 63 61 74 65 20 74 ed to indicate t
08b0: 68 65 20 74 79 70 65 20 6f 66 20 64 69 61 6c 6f he type of dialo
08c0: 67 20 70 72 65 73 65 6e 74 65 64 20 62 79 20 3c g presented by <
08d0: 74 74 3e 77 65 62 76 69 65 77 2d 64 69 61 6c 6f tt>webview-dialo
08e0: 67 3c 2f 74 74 3e 3a 0d 0a 0d 0a 20 20 2a 20 20 g</tt>:.... *
08f0: 3c 74 74 3e 6f 70 65 6e 3c 2f 74 74 3e 20 73 68 <tt>open</tt> sh
0900: 6f 77 73 20 61 20 66 69 6c 65 20 6f 70 65 6e 20 ows a file open
0910: 64 69 61 6c 6f 67 0d 0a 20 20 2a 20 20 3c 74 74 dialog.. * <tt
0920: 3e 73 61 76 65 3c 2f 74 74 3e 20 73 68 6f 77 73 >save</tt> shows
0930: 20 61 20 66 69 6c 65 20 73 61 76 65 20 64 69 61 a file save dia
0940: 6c 6f 67 0d 0a 20 20 2a 20 20 3c 74 74 3e 64 69 log.. * <tt>di
0950: 72 65 63 74 6f 72 79 3c 2f 74 74 3e 20 61 6c 6c rectory</tt> all
0960: 6f 77 73 20 73 65 6c 65 63 74 69 6f 6e 20 6f 66 ows selection of
0970: 20 61 20 64 69 72 65 63 74 6f 72 79 20 69 6e 73 a directory ins
0980: 74 65 61 64 20 6f 66 20 61 20 66 69 6c 65 0d 0a tead of a file..
0990: 20 20 2a 20 20 3c 74 74 3e 69 6e 66 6f 3c 2f 74 * <tt>info</t
09a0: 74 3e 20 73 68 6f 77 73 20 61 6e 20 69 6e 66 6f t> shows an info
09b0: 72 6d 61 74 69 6f 6e 61 6c 20 6d 65 73 73 61 67 rmational messag
09c0: 65 0d 0a 20 20 2a 20 20 3c 74 74 3e 77 61 72 6e e.. * <tt>warn
09d0: 69 6e 67 3c 2f 74 74 3e 20 73 68 6f 77 73 20 61 ing</tt> shows a
09e0: 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 warning message
09f0: 0d 0a 20 20 2a 20 20 3c 74 74 3e 65 72 72 6f 72 .. * <tt>error
0a00: 3c 2f 74 74 3e 20 73 68 6f 77 73 20 61 6e 20 65 </tt> shows an e
0a10: 72 72 6f 72 20 6d 65 73 73 61 67 65 0d 0a 0d 0a rror message....
0a20: 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c <h3>procedure: <
0a30: 63 6f 64 65 3e 28 77 65 62 76 69 65 77 2d 64 69 code>(webview-di
0a40: 61 6c 6f 67 20 3c 69 3e 77 65 62 76 69 65 77 3c alog <i>webview<
0a50: 2f 69 3e 20 3c 69 3e 74 79 70 65 3c 2f 69 3e 20 /i> <i>type</i>
0a60: 3c 69 3e 74 69 74 6c 65 3c 2f 69 3e 20 3c 69 3e <i>title</i> <i>
0a70: 76 61 6c 75 65 3c 2f 69 3e 29 3c 2f 63 6f 64 65 value</i>)</code
0a80: 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 3e 70 72 6f 63 ></h3>..<h3>proc
0a90: 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28 77 65 edure: <code>(we
0aa0: 62 76 69 65 77 2d 64 69 61 6c 6f 67 20 3c 69 3e bview-dialog <i>
0ab0: 77 65 62 76 69 65 77 3c 2f 69 3e 20 3c 69 3e 74 webview</i> <i>t
0ac0: 79 70 65 3c 2f 69 3e 20 3c 69 3e 74 69 74 6c 65 ype</i> <i>title
0ad0: 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 </i>)</code></h3
0ae0: 3e 0d 0a 0d 0a 50 72 65 73 65 6e 74 20 61 20 64 >....Present a d
0af0: 69 61 6c 6f 67 20 61 73 20 61 20 6d 6f 64 61 6c ialog as a modal
0b00: 20 63 68 69 6c 64 20 6f 66 20 74 68 65 20 67 69 child of the gi
0b10: 76 65 6e 20 77 65 62 76 69 65 77 2e 20 52 65 74 ven webview. Ret
0b20: 75 72 6e 73 20 74 68 65 20 64 61 74 61 20 73 65 urns the data se
0b30: 6c 65 63 74 65 64 20 69 6e 20 74 68 65 20 64 69 lected in the di
0b40: 61 6c 6f 67 20 6f 72 20 3c 74 74 3e 23 66 3c 2f alog or <tt>#f</
0b50: 74 74 3e 2e 0d 0a 0d 0a 3c 68 32 3e 4d 69 73 63 tt>.....<h2>Misc
0b60: 65 6c 6c 61 6e 65 6f 75 73 3c 2f 68 32 3e 0d 0a ellaneous</h2>..
0b70: 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a ..<h3>procedure:
0b80: 20 3c 63 6f 64 65 3e 28 6c 6f 67 66 20 3c 69 3e <code>(logf <i>
0b90: 66 6d 74 3c 2f 69 3e 20 3c 69 3e 61 72 67 3c 2f fmt</i> <i>arg</
0ba0: 69 3e 20 2e 2e 2e 29 3c 2f 63 6f 64 65 3e 3c 2f i> ...)</code></
0bb0: 68 33 3e 0d 0a 0d 0a 4c 6f 67 20 61 20 66 6f 72 h3>....Log a for
0bc0: 6d 61 74 74 65 64 20 6d 65 73 73 61 67 65 20 74 matted message t
0bd0: 6f 20 73 6f 6d 65 20 73 79 73 74 65 6d 2d 73 70 o some system-sp
0be0: 65 63 69 66 69 63 20 63 68 61 6e 6e 65 6c 2e 0d ecific channel..
0bf0: 0a 0a 5a 20 65 32 62 32 61 62 31 33 33 62 34 61 ..Z e2b2ab133b4a
0c00: 39 39 32 39 64 61 36 32 33 65 61 61 33 32 32 39 9929da623eaa3229
0c10: 65 32 32 32 0a e222.