Petrus K. Petrus K. - 1 year ago 28
Javascript Question

Accessing JavaScript file in HTML through parent level directories on an HTTP server

I'm trying to access hellotest.js, which is located in the parent directory of my index2.html file.

I'm having no luck doing this, the fix should be simple and I have tried looking for an answer.

The absolute path to the files are (Ubuntu/Linux):


EDIT: I'm running this on an http-server: http-server, SimpleHTTPServer

<script src="../hellotest.js" type="text/javascript"></script>
<title>test website</title>
<p>hello world 2</p>


I resolved this problem eventually by creating symlinks.
In Linux/Ubuntu you can do this with: ln -s <symlink_origin> <symlink_destination