Link to home
Create AccountLog in
Avatar of AIGS
AIGSFlag for Australia

asked on

Would like to place Javascript files in parent folder to where my site resides on a shared hosting server. How do I reference those files so they are loaded?

Site is on shared hosting server e.g.

/home/mywebsite.com.au

I want to place all my javascript in /home/js/ (parent folder to website root)

How can I reference the src of the javascript files to be loaded from /index.html within mywebsite.com.au where they reside in /home/js/?


Avatar of David S.
David S.
Flag of United States of America image

AIGS, would you please help us understand why you want to place files in a location where they won't be made available to visitors by the web server, but then make them available anyway?

Michel, AIGS seems to be referencing server paths, not web paths.
Ah, I missed that. Yeah that does not make much sense.
To do so you would need to serve them using a server proxy that CAN read that location. Noting gained by doing that. If you want to try to stop ppl from stealing the images, then that is not possible since once they see them, they are on their computer
Avatar of AIGS

ASKER

I have a number of websites using the same hosting account and thought it would be better to have one lot of js for them all to use rather than have multiple copies of the same js.

You can, but then you need to serve them with a server process that reads the files and serves them from there

ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer