Add request address scheme to cookie_handler's arguments.
[uzbl-mobile] / README
diff --git a/README b/README
index 801ee34..d5db188 100644 (file)
--- a/README
+++ b/README
@@ -9,8 +9,8 @@
 * invoke uzbl --help
 * to get you started: `XDG_DATA_HOME=/usr/share/uzbl/examples/data XDG_CONFIG_HOME=/usr/share/uzbl/examples/config uzbl --uri www.archlinux.org`
 * study the sample config, have a look at all the bindings, and note how you can call the scripts to load new url from history and the bookmarks file
-* note that there is no url bar. all url editing is supposed to happen _outside_ of uzbl.
-  For now, you can use the `load_from_*` dmenu based scripts to pick a url or type a new one or write commands into the fifo (see /usr/share/uzbl/docs/CHECKLIST)
+* You can change the url with commands (if you have setup the appropriate keybinds) but to be most effective it's better to do url editing/changing _outside_ of uzbl.
+  Eg, you can use the `load_from_*` dmenu based scripts to pick/edit a url or type a new one.
 * If you have questions, you are likely to find answers in the FAQ or in the other documentation.
 
 
@@ -26,8 +26,8 @@ Time to change that!
   Here are the general ideas:
 
 * each instance of uzbl renders 1 page (eg it's a small wrapper around webkit), no tabbing, tab previews, or speed dial things.
-  For "multiple instances management" use your window managers, or scripts. 
-  This way you can get something much more useful than tabbing (see rationale in docs)
+  For "multiple instances management" use your window managers, scripts or wrappers. 
+  This way you can get something much more useful than tabbing by default
 * very simple, plaintext , changeable at runtime configuration
 * various interfaces for (programmatic) interaction with uzbl (see below)
 * customizable keyboard shortcuts in vim or emacs style (whatever user wants)
@@ -61,7 +61,7 @@ There are several interfaces to interact with uzbl:
 
 * uzbl --config <filename>: <filename> will be read line by line, and the commands in it will be executed.  useful to configure uzbl at startup.
   If you have a file in `$XDG_CONFIG_HOME/uzbl/config` (this expands to ~/.config/uzbl/config on most systems) it will be automatically recognized
-* stdin: you can also write commands into stdin
+* stdin: to write commands into stdin, use `--config -` (or `-c -`)
 * interactive: you can enter commands (and bind them to shortcuts, even at runtime)
   By default, the behaviour is modal (vi style):
   command mode: every keystroke is interpreted to run commands
@@ -95,8 +95,8 @@ The following commands are recognized:
    - used for changing variables on the fly
    - the changes are effective immediately; for example, setting the variable `uri` will make uzbl start loading, and changing `status_format` will make the status bar react immediately
    - if you want to unset a string, use `set` with one space after the equals sign
-* `get <key>`
-   - use this to print the value of a variable. (and TODO, get the value through the socket)
+* `print @<key>`
+   - use this to print the value of a variable.
 * `bind <string> = <command>`
    - sets the character sequence `<string>` to invoke `<command>` when typed interactively in uzbl
    - there are a few tricks you can do:
@@ -161,6 +161,38 @@ The following commands are recognized:
    - remember to quote the commands; one command must come as one parameter
    - if you use `chain` with a handler script which must return some output (such as a cookie handler -- uzbl will wait for and use its output), use sync_spawn or sync_sh instead of spawn or sh in the command that should give the output
 
+### JAVASCRIPT HELPER OBJECT
+
+Javascript code run from uzbl is given a special object in the global namespace which gives special privileges to these scripts. This object is called `Uzbl`, and it is added and removed before and after the script execution so that it is hidden to web javascripts (There is no race condition, since all the javascript code runs in a single thread)
+
+Currently, the `Uzbl` object provides only one function:
+
+* `Uzbl.run( <command> )`
+   - command is any uzbl command as defined above
+   - return value: a string, either empty or containing the output of the command. Very few commands return their output currently, including js, script, and print.
+   - Examples:
+       * `Uzbl.run("spawn insert_bookmark.sh")`
+       * `uri = Uzbl.run("print @uri")` (see variable expansion below)
+
+### JAVASCRIPT SECURITY
+
+Since defined variables and functions are set in the global namespace (`window` object) as default, it is recommended to wrap your scripts like this:
+
+    (function(Uzbl) {
+        ...
+    })(Uzbl);
+
+This way, everything is kept private. It also turns Uzbl into a local variable, which can be accessed from callback functions defined inside. However for some situations, isolating everything isn't an option, for example, with binds. You can define them directly in the script body, and use `var Uzbl = window.Uzbl;` to make the Uzbl variable local, as in the following example:
+
+    function f() {
+        var Uzbl = window.Uzbl;
+        Uzbl.run(...);
+        setTimeout(function() {
+            Uzbl.run(...);
+        }, 500);
+    }
+
+Copying the Uzbl object and creating public functions should be taken with care to avoid creating security holes. Keep in mind that the "f" function above would be defined in the `window` object, and as such any javascript in the current page can call it.
 
 ### VARIABLE EXPANSION AND COMMAND/JAVA SCRIPT SUBSTITUTION
 
@@ -258,23 +290,29 @@ The script specific arguments are this:
 * cookie handler
 
     $8 GET/PUT
-    $9 request address host (if current page url is www.foo.com/somepage, this could be something else then foo, eg advertising from another host)
-    $10 request address path
-    $11 cookie (only with PUT requests)
+    $9 request address scheme (e.g. http or https)
+    $10 request address host (if current page url is www.foo.com/somepage, this could be something else than foo, eg advertising from another host)
+    $11 request address path
+    $12 cookie (only with PUT requests)
 
 
 Custom, userdefined scripts (`spawn foo bar`) get first the arguments as specified in the config and then the above 7 are added at the end.
 
 ### COMMAND LINE ARGUMENTS
-
-    -u, --uri=URI            Uri to load (equivalent to 'set uri = URI')
+    uzbl [ uri ]
+    -u, --uri=URI            alternative way to load uri on start. (equivalent to 'set uri = URI')
     -v, --verbose            Whether to print all messages or just errors.
     -n, --name=NAME          Name of the current instance (defaults to Xorg window id)
-    -c, --config=FILE        Config file (this is pretty much equivalent to uzbl < FILE )
+    -c, --config=FILE        Config file (or `-` to use stdin)
+    -s, --socket=SOCKET      Socket ID
+    -V, --version            Print the version and exit
     --display=DISPLAY        X display to use
     --help                   Help
 
 
+
+
+
 ### BUGS
 known bugs: