lfrohman
asked on
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
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
My mistake... <img src="../image/pic.gif" />
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//i mages//ima ge1.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.
file://D://website-name//i
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
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
ASKER
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:\".
What is the URL, especially the protocol part, when you run the file locally in Firefox?
bol
bol
ASKER
file:///C:/xx/test.html
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
<img src="file:///C:/image/pic.
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
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Your welcome! I'm glad I could help. Thanks for the grade, the points and the fun question.
bol
bol
Never ever hard code from your drive letters to the image.