Module Js_of_ocaml.Url
This module provides functions for tampering with Url. It's main goal is to allow one to stay in the Ocaml realm without wandering into the Dom_html.window
##.location object.
val urldecode : string -> string
urldecode s
swaps percent encoding characters for their usual representation.
val urlencode : ?with_plus:bool -> string -> string
urlencode ?with_plus s
replace characters for their percent encoding representation. Note that the '/' (slash) character is escaped as well. Ifwith_plus
istrue
(default) then'+'
's are escaped as"%2B"
. If not,'+'
's are left as is.
type http_url
=
{
}
The type for HTTP(s) url.
type file_url
=
{
fu_path : string list;
fu_path_string : string;
fu_arguments : (string * string) list;
fu_fragment : string;
}
The type for local file urls.
type url
=
|
Http of http_url
Non secure HTTP urls
|
Https of http_url
Secure HTTPS urls
|
File of file_url
Local files
The type for urls.
val path_of_path_string : string -> string list
path_of_path_string s
splitss
on each"/"
character.
val encode_arguments : (string * string) list -> string
encode_arguments a
expects a list of pair of values of the form(name,value)
werename
is the name of an argument andvalue
it's associated value.
val decode_arguments : string -> (string * string) list
decode_arguments s
parsess
returning the sliced-diced association list.s
should be only the arguments part (after the '?') not the whole url.
val url_of_string : string -> url option
url_of_string s
parsess
and builds a value of typeurl
ifs
is not a valid url string, it returnsNone
.
val string_of_url : url -> string
string_of_url u
returns a valid string representation ofu
. Note that *string_of_url ((fun Some u -> u) (url_of_string s))
is NOT necessarily * equal tos
. Howeverurl_of_string (string_of_url u) = u
.
module Current : sig ... end
This module can be used to handle the Url associated to the current document.