Reputation: 52523
I know this is a noob question, but I haven't really encountered this yet or have dealt with it using .NET's RelativeUrl()
. I just modified the directory structure of some flat HTML files and everything is broken. Of course I know why and how to fix it, but I was wondering if there was a failsafe, non-backend solution to always getting the correct path for your assets (img, script, css, etc)
Right now I know I'm going to have to do "../../[directory]/[file]" but I was hoping there was something easier that I just haven't come across.
Thanks
Upvotes: 0
Views: 80
Reputation: 12281
you can simply go from the root folder everytime by putting a "/" before your path
e.g.
<img src='/images/image.jpg' />
Upvotes: 1
Reputation: 253308
Have you come across root-relative paths? Basically they're paths that are, obviously I suppose, relative to the root of the website, of the form:
/directoryName/fileName.html
Further information: http://www.motive.co.nz/glossary/linking.php
Upvotes: 1