Relative Link To Local File

4.8k views Asked by At

I have a local HTML file that we are using as a USB Menu - when the USB device is plugged in the webpage will automatically open and show our menu.

In our menu we have a link to our installer. When the user clicks the link it opens our installer window.

The code is:

<a href="file:///C:/Test_USB_Menu/src/Company Plugins.exe">Install Our Plugins</a>

The link works fine but we want to make the link to the file relative. Ie, make it;

<a href="file:///src/Company Plugins.exe">Install Our Plugins</a>

But when I change this the file no longer opens when I click the link. Any ideas what I am doing wrong? Is it possible to have relative paths for files?

The folder structure is like so:

- Root USB
  - AUTORUN.html
  - src
     - Company Plugins.exe
1

There are 1 answers

2
bogeylicious On

I think you just want to remove the prefix scheme. Try:

<a href="/src/Company Plugins.exe">Install Our Plugins</a>

You could also try a . operator to signify the current directory:

<a href="file:///./src/Company Plugins.exe">Install Our Plugins</a>