D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] directories in javascript



On Monday 12 May 2003 9:32 pm, dave morgan wrote:
> hi,
>
> I have put the first bit of javascript I have ever used
> on my website, at www.eclipse.co.uk/morgad/exmplmenu var.js
> but I having massive trouble getting the links to work
> when I call the script from other directories
> (e.g. www.eclipse.co.uk/morgad/aquapics/diary.html )
>
> I have got round it for now by hardcoding the
> www.eclipse.co.uk/morgad/ root into all paths
> but there has to be a better way than this.
>
> (it stops my home mirror/offline development copies working)
>
> any ideas ?

http://www.codehelp.co.uk/query/glossaryL.shtml#location

I don't know if Javascript can deal with relative links. I suspect it is a 
problem related to being client-side. Server-side scripts have a present 
working directory to use, client side scripts must obtain this information 
for themselves. The location can describe this - you could use the hostname 
to dictate which hardlink to use and this will get you around the offline 
problem.

Alternatively, are symlinks possible? (After all, this is the local system and 
other scripts etc. are going to have similar problems unless the path 
structure is the same as the live site. I use symlinks for various websites.)

For a definite answer, send me the full Javascript by email and I'll take 
another (deeper) look.


-- 

Neil Williams
=============
http://www.codehelp.co.uk
http://www.dclug.org.uk

http://www.wewantbroadband.co.uk/

Attachment: pgp00013.pgp
Description: signature


Lynx friendly