User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 397,714 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,498 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting

.gif in firefox

Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 47
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: .gif in firefox

  #7  
Mar 9th, 2007
if you want to link to a local file as the image; use the 'file' protocol explicitly:
<img src="file:///C:\webroot\images\logo.gif" width="650" height="110">
maybe those (\) should be the other way round; so if it doesn't work like that; try:
<img src="file:///C:/webroot/images/logo.gif" width="650" height="110">
Also, check out: http://en.wikipedia.org/wiki/File:_URL

It loads without in IE because IE perhaps 'expects' windows/DOS paths.. It's not a correct URL though; because unless an URL is relative or root-relative; it has to have a protocol specified.

Putting an url like this src="/webroot/images/logo.gif" will work; but it's deceptive because it's root-relative to a local drive; wheras on the web; it'll be root relative to a 'home' or 'My Documents' folder (depending on the server OS, and may be different); with a document root folder inside.

That is; if/when you put your page online; it's likely that the document root folder will be at the level of 'webroot', so your url will end up "/images/logo.gif". On the server; the root-absolute path "/images" may end up pointing to a folder like; "/home/sam1/htdocs/images" (if you're on a linux server running apache); and that might be accessible from the web as : "http://www.sam1.com/images". However; the URL: "file:///c:\anything" is only accessible on your computer.

You can get around that by making ALL links relative (i.e: if your page is in a folder "C:\webroot\stuff\index.html"; and the image is in the folder "C:\webroot\images\logo.gif"; make the src="../images/logo.gif") but; that can get reaaaally difficult to manage. Or, upload your images to where you want them to be on the web, and use an HTTP protocol url i.e. "http://www.sam1.com/images/logo.gif". If you don't do something like that; and you make everything absolute with reference to your filesystem; you'll have to go and change all your links when you come to upload your site to the server.
Last edited by MattEvans : Mar 9th, 2007 at 6:38 am.
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
All times are GMT -4. The time now is 2:02 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC