I have a small javascript library written by myself. I want to reference it in my web application, but it doesn't work
<script src='file:\\C:\Path\To\Script\Script.js'></script>
Is it possible to reference javascript when all you know is the absolute path?
A path is either relative or absolute. An absolute path always contains the root element and the complete directory list required to locate the file. For example, /home/sally/statusReport is an absolute path. All of the information needed to locate the file is contained in the path string.
An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words,we can say that an absolute path is a complete path from start of actual file system from / directory. Relative path is defined as the path related to the present working directly(pwd).
The file:
url needs 3 forward slashes, and the path also needs forward slashes:
<script src='file:///C:/Path/To/Script/Script.js'></script>
This will ofcourse only work if you load the script within a html-file on your disk that's loaded in your browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With