Aaron Thomas Aaron Thomas - 1 year ago 98
HTML Question

Relative url in static html

I'm creating a small document in html, that I will be sharing via email.

The document will have one jpg image, and it will rely on jquery to perform an animation on the image.

The html file, jpg file, and jquery (minimized) file are all contained in the same folder. When I share, I'd like to simply email this folder with its contents (probably by zipping the folder).

How can urls within the html file be structured so that they point to the image and the jpg within the same folder as the html file itself, regardless of where that folder is placed in a folder structure?

For example, in the current url (which needs to be changed) the hardcoded

for referencing jquery looks like this:

<script src="file:///C:/Users/Me/Documents/jQuery/jquery-2.1.4.min.js"></script>

Please note this is not a jquery-specific question, because the question is about how to structure my URLs. I simply include jquery in the example to illustrate an existing URL.

Answer Source

Simply put

<script src="jQuery/jquery-2.1.4.min.js"></script>

or put all in the same folder

<script src="jquery-2.1.4.min.js"></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download