CONVERTING all links by a simple TRICK ? like BASE for RELATIVE PATH ?

E

equation

I have a long html of links with hrefs like this:

href="/directory/subdir/file.pdf"

when I put this site on my internal server, I can see it from a client
machine using the html of links on my client if I only put this line in
the <head> of the html document:

<BASE href="http://myserver/" >

Now,

I put this site on my client on a CD for example running as drive G: .
Its a window machine.

I must modify every link in my html file as follows:

href="./directory/subdir/file.pdf"

or as

href="../directory/subdir/file.pdf"

or as

href="../somelongpath/directory/subdir/file.pdf"

depending on the relative position of my html of links with respect to
the pdf on the same machine.


But due to "somelongpath" the html file becomes messy and I want to
make minimal changes.
Furthermore, I want to put my html file on the same CD. I also want
this CD to be transportable
from machine to machine so that CD may be called D: E: F: or G: etc.

Is there a simple solution to this using something like <BASE href="">
in the head to apply it to all the links?

I tried a few hacks with the BASE but it only seems to cause changes in
absolute path, not the relative path.

I appreciate any help.

equation.

SUMMARY:
(1) a simple method to make the absolute hrefs to relative without
editing them, by somehow prepending to them "../somelongpath/"
 
E

equation

Can anyone with a higher IQ or better memory of html syntax help me out
with this probleme?
 
B

Ben C

Can anyone with a higher IQ or better memory of html syntax help me out
with this probleme?

Is the pdf on the CD?
But due to "somelongpath" the html file becomes messy and I want to
make minimal changes.
Furthermore, I want to put my html file on the same CD. I also want
this CD to be transportable
from machine to machine so that CD may be called D: E: F: or G: etc. [snip]
SUMMARY:
(1) a simple method to make the absolute hrefs to relative without
editing them, by somehow prepending to them "../somelongpath/"

I don't believe this is possible without editing the hrefs to make them
all relative. As you discovered, and as it says in the HTML standard,
the href attribute of the BASE element has to be an absolute URI.

Why can't you edit the hrefs?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top