Relative Paths

By default, all the topics I cover that include a reference to a javascript file assume that the topic and the javascript file are in the root of your project. In reality, whilst I would recommend that you keep the javascript files in the root, your topics are likely to be in folders. It is therefore necessary to amend the script reference so that the topic knows where the javascript file is located.

So if you are adding a reference such as

<script type="text/javascript"
                  language=JavaScript1.2
                  src="myjavafile.js"></script>

to a topic that is one folder level down, amend the last line to

src="../myjavafile.js"></script>

TIP: Look at the path for the CSS file that the topic uses

If it is ..\stylesheet.css, the path you need is ../myjavafile.js

If it is ..\..\stylesheet.css, the path you need is ../../myjavafile.js

You will notice that I have used forward slashes. I have found that RH does not always convert the backslashes to forward slashes when generating and publishing. Most of the time it does but sometimes it fails. If the output is being viewed in IE it will work regardless but Firefox is stricter and will only recognise forward slashes.

If you are using an editor other than RoboHelp, then always use forward slashes.

Revisions

Date

Changes to this page

15 Jan 2006

This topic was originally a popup accessed from various other topics. In converting the site to being Dreamweaver based, I decided to make it a standalone topic.