Page 1 of 1

Absolute path

Posted: Fri Jun 19, 2009 6:25 am
by jp50
Hi to all,
I'm using absolute path for the images like
/img_folder/img.png
and it works fine in IE and Mozilla but not in Safari. If I change the absolute path in
C:/site-root/mysite/img_folder/img.png
then it works in IE,Safari but not in Mozilla.The question is: how can I use absolute path that is supported by the major browsers?
Thanks

Re: Absolute path

Posted: Fri Jun 19, 2009 6:30 am
by jayshields
Are you hosting/accessing the site locally?

You should specify absolute paths with the URL, not the drive letter.

Re: Absolute path

Posted: Fri Jun 19, 2009 9:15 am
by jp50
I'm hosting this web site locally on a windows server 2003 IIS 6

Re: Absolute path

Posted: Fri Jun 19, 2009 10:12 am
by pickle
I think what ~jayshields was getting at was that this URL: "C:/site-root/mysite/img_folder/img.png" won't work for anyone that's not you.

Re: Absolute path

Posted: Fri Jun 19, 2009 7:15 pm
by jp50
pikle,the server is on my computer therefore the root relative path /images/img.ping should work as well as the root absolute path which is C:/site-root/mysite/img_folder/img.png but it could be anywhere the site is stored.And it does workThe question was: why it's not recognised by all browsers the same?

Re: Absolute path

Posted: Tue Jun 23, 2009 3:33 pm
by bshultz
Some browsers will interpret the path the folder based on where you launch the link from and others won't. If it is hosted locally and you launch the page from an 'open' command in a browser, say FireFox, it will know that it can locally reference the file. Ultimately it may be a problem when you post your site live and you should always try and use relative paths whenever possible.