[Ur] local urls for the script directive
Timothy Beyer
beyert at fastmail.net
Wed Apr 25 19:30:09 EDT 2012
Hi,
I recently figured out how to use the javascript FFI properly, but one thing
that has bothered me is that my javascript files need to be hosted somewhere,
or locally on another web service on the same machine.
Is there any way that Ur/Web itself can host the js file? I've read the
documentation as much as possible, but I'm still not sure how to do something
like this.
For a script named "jsAlert" in a project called "AlertJs" [1], I've tried the
following directives:
script http://[web-host-url-and-path-goes-here]/jsAlert.js
script http://localhost/jsAlert.js
script http://localhost/AlertJs/jsAlert.js
script http://localhost:8080/jsAlert.js
script http://localhost:8080/AlertJs/jsAlert.js
script jsAlert.js
script ./jsAlert.js
Other than the externally hosted js file script directive mentioned first,
(which works properly, but I'd rather not also run lighttpd or nginx if
possible) none of the other script directives have worked. The latter two
attempts I knew would not work, but I tried anyway for the sake of
completeness. I think that there is already a way to do this, because the
setInner example in tests/ does specifies the host as localhost, but I couldn't
get that particular example to work properly, so I'm not sure.
Should I be using the "allow url ..." directive?
Would the "rewrite" directive allow me to do this?
Also, it would be nice if Ur/Web logged a failure to find the js file on the
console, when the "script" directive is invalid. (I haven't tried the debug
flag, maybe that enables such a behavior?) I unknowingly had the javascript FFI
otherwise working in a recent attempt, only to find out that the only issue was
that it couldn't find the javascript definitions.
Regards,
Tim
[1] I access the project at the URL http://localhost:8080/AlertJs/main, as with
most Ur/Web projects. I don't use any rewrite directives on this project, yet.
More information about the Ur
mailing list