Search code examples
javascriptlibrariesstratifiedjs

StratifiedJS in external script


I recently found StratifiedJS library. It has many features that I really need. It works great, unless I try to use it in external script.

It works great in my html file like this:

<script src="libraries/stratified.js"></script>
<script type="text/sjs">
 

</script>

But when I try to link it to external script, following official documentation on: http://onilabs.com/stratifiedjs, it just does not work.

<script src="http://[...]/stratified.js" main="./init"></script>

Console always pops up this error:

Not Found (404)
    at apollo-sys-xbrowser.sjs:345
    at apollo-sys-common.sjs:1071
    at apollo-sys-common.sjs:957
    at apollo-sys-common.sjs:1006
    at apollo-sys-common.sjs:1028
    at apollo-sys-common.sjs:1219
    at apollo-sys-common.sjs:716
    at apollo-sys-xbrowser.sjs:536

PS: I changed the path to file stratified.js file.

I’m lost in this. Can someone please explain what am I doing wrong. Thanks


Solution

  • Your browser cannot find the file 'init.sjs'.

    How are you serving your html file (the one that contains the <script ... main='./init'></script>)?

    The idea is that it is being served by a HTTP server (Apache, Conductance, whatever), and that the directory that you serve it from also contains a file init.sjs.