Place "libraries" folder outside of web root

edited April 2016 in p5.js

Hello, the question is actually only indirectly p5.js related..
On a web host I'd like to have a library folder that website main folders could have in common. If this is possible, it would require entering src into the html with the opposite of ../ , meaning one hierarchy further up. What would be the syntax for this?
Any help very appreciated,


  • edited April 2016

    Ok from what I have read it seems like I cannot directly access a file which is outside of the root directory of the website. There must be some php trick do get around it but probably totally unnecessary in this case as even with some additional p5 libraries the entire folder won't exceed a few Mb.
    The only reason I wanted to know is because I have a web host that allows 3 sites (pretty cool actually: - so, as I use these sites to try out p5.js content, I was hoping to use a shared libraries folder for the 3 of them.

  • Answer ✓

    Sites can activate CORS in order to allow their files to be accessed w/ the same credentials as local:

  • Cross origin requests for JS files aren't subject to any restrictions so you don't need to worry about CORS (that's how JSONP works). You can put your lib files at the root of any of your sites and use the full path...

  • Or just use cdn repositories for standard libraries...

  • Great, thank you! I'll try this out..

Sign In or Register to comment.