How can I set Firefox's root directory for absolute file addresses in Windows?

For example,
if my web page is C:\web\test.html, and the image is C:\image\pic.gif
I want to put the image in test.html as
<img src="???/pic.gif" />
 
<img src="/image/pic.gif" />
doesn't work in Firefox or Safari
 
lfrohmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zkeownCommented:
You need to just put <img src="pic.gif" /> in that case.

Never ever hard code from your drive letters to the image.  
0
zkeownCommented:
My mistake... <img src="../image/pic.gif" />
0
scrathcyboyCommented:
I think you are missing the point of a web development program.  Yes the files reside on your local hard drive while you are writing the code, but when you upload, you need to let the web designer change the links to the file locations based on what it would be on the web.  SO whe you see something like this --

file://D://website-name//images//image1.gif -- just leave it that way, this will be REPLACED by the real location on the internet server, once the files are uploaded to the webserver.  This is true EVEN IF you have you website on your own personal computer.  You cannot, and should not give direct links to the files on C, as they will never resolve when you upload them to the website.  If you are hosting your own website on C, FORGET THAT FACT -- it is important for all the relative links to files on the web server to be rewritten for WEB access, not local hard disk access.  I hope this is clear.  
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

b0lsc0ttIT ManagerCommented:
lfrohman,

I believe the comments above will get the path and image right and have given you good advise on what you should use as the path.  The problem you had may have been mixing the protocol.  Firefox and some other browsers won't let you use an http: protocol in the address and file: protocol for images, etc.  If you use relative paths as described above and keep your production and testing folder setup similar then things will work very smoothly.

Let me know if you have any questions or need more information.

b0lsc0tt
0
lfrohmanAuthor Commented:
The files all refer to "/xx/test.gif" using absolute addresses so that they can be uploaded and will run correctly on the web.  Unfortunately, in Firefox they don't resolve to c:\xx\test.gif under Windows when running the files locally.  What I need is a way to tell Firefox to resolve "/" to "C:\".
0
b0lsc0ttIT ManagerCommented:
What is the URL, especially the protocol part, when you run the file locally in Firefox?

bol
0
lfrohmanAuthor Commented:
file:///C:/xx/test.html
0
b0lsc0ttIT ManagerCommented:
Thanks for the response.  Does it work if you use the full path?  Keep the html page and image in the folders they are in now and try using the full path for the image tag.  For example ...

<img src="file:///C:/image/pic.gif">

Are the folders in the comments above accurate of what you are trying to do?  The name may be different but are they both folders on the root of the C drive?

Have you tried using the base tag?  Use something like ...

<base href="file:///C:/" />

How does that work?

bol
0
lfrohmanAuthor Commented:
It does work using the full path "file:///C:/image/pic.gif", and the <base> tag can be used to set a base for all relative addresses.  But <base> can't be used as a prefix for absolute addresses.
0
b0lsc0ttIT ManagerCommented:
Thanks for the info and trying that.  I knew about the base tag but was hoping it may help for the absolute path too.

I don't have a specific cause for this in browsers but from experience I would say it is related to security.  I know of a way to use config to bypass the protocol security I mentioned in your own Firefox browser but I am not sure it would solve this issue for you.  It definitely wouldn't be something you could just carry to Safari.

What was the result in IE when you tried this?  Have you tried IE7 and IE6?  I don't know that this will provide info to help for a solution but it may.

Basically if the above hasn't worked then you are probably out of luck.  Any fix in one browser would have to be done in the browser and be browser specific.  This type of issue is the reason development machines are set up to be like the production machine and relative paths are used.

Let me know if you have a question about any of this.

bol
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lfrohmanAuthor Commented:
Thanks
0
b0lsc0ttIT ManagerCommented:
Your welcome!  I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.