Commit 80cb510a authored by Kim Nguyễn's avatar Kim Nguyễn

[trywhy3]: automatically revert to loading embedded resources when

	   trywhy3.html is accessed from a file:// URL.
parent d5116397
......@@ -84,8 +84,10 @@ Instructions to build TryWhy3
cd examples/
../gen_index.sh *.mlw > index.txt
** [optional] If you want trywhy3 to only use its embedded files
(e.g. to run it simply by opening trywhy3.html with a web browser
instead of putting it on a webserver), change the variable
declaration 'var load_embedded_files = false;' to
'var load_embedded_files = true;' in the header section of trywhy3.html.
\ No newline at end of file
** [optional] If you want trywhy3 to only use its embedded files,
change the variable declaration 'var load_embedded_files = false;'
to 'var load_embedded_files = true;' in the header section of
trywhy3.html.
Note that this is the default behaviour when trywhy3.html is opened from
a file:// URL rather than an http(s):// URL, regardless of the value of
the load_embedded_files variable.
\ No newline at end of file
......@@ -41,7 +41,10 @@ module XHR =
struct
include XmlHttpRequest
let load_embedded_files = Js.to_bool (get_global "load_embedded_files")
let load_embedded_files =
Js.to_bool (get_global "load_embedded_files") ||
Js.to_string (Dom_html.window ## location ## protocol) = "file:"
let make_url =
if load_embedded_files then
fun u ->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment