Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
am building a local app
and am calling images embedded in an html page from the local file system like this:
<img src="file://localhost/d:/image.jpg" border="0">
and the image is not showing on the page!
what is happening:
IE displays the images fine
but firefox and opera don't
firefox and opera will both display the image if i just put
directly into the address bar.
obviously for some reason they don't want to show local files embedded in an html page, is this some kind of security issue or do i have the syntax wrong?
Since there is normally no way to know on what drive a file will be, using drive-specific urls is lunacy.
You may begin urls with / if they must be relative to a drive root but, as BlobFisk said, relative urls is the way to go unless you have a specific reason otherwise.
I assume you are working in the same sort of way that I am: the webpages having their full links expanded when uploaded. When uploaded to a remote destination they become [test.com...] and when uploaded to a loca desination they become file://localhost/yadda-yadda
I do that all the time. As it is automatic (controlled by the software), I never have to worry about relative or absolute URLs. They all become absolute on upload, thus reducing 302 hijacking risks.
Also, it works fine with my partner who uses a MAC. The local file paths get correctly converted.
So: no problem with what you are doing. May be a problem with the version of Opera. I used to have the same problem. Don't any more.
>>Strange! Is the a specific reason why you wouldn't consider relative links?
i'm using xp pro and iis only allows 1 website (i know i can change this around but when i'm just working briefly on another project i don't want to be bothered with changing the settings)
in this case i'm running scripts in a virtual folder in the 'local 127.0.0.1' website but i just want to access/view images that are not under the root and i don't want to keep creating virtual folders under the root for the image folders (which would be a solution of course) its easier just to hard code the path into the script page.
the image folders are on seperate drives to the web server.
to be honest i'm not sure what the relative path would be bewteen
127.0.0.1/folder/script.asp (iis located on c drive)
would be and indeed if it is possible to link in that way.
>>Since there is normally no way to know on what drive a file will be, using drive-specific urls is lunacy.
yes agreed, but in this case, this app is for my own use on my own local computer and i do know what drives are located on.
victor >> yes pretty much on the money this is just local stuff, when its uploaded to the live server it all links up properly, thanks for the tip, i'll prob just have to upgrade opera been meaning to anyway.
>>You could try setting the base URL in the code at the top
good idea but don't think it will work as i'm trying to access the file system outside of the website root anyway, plus if i set the base to d: for instance all the other links would be thrown off. - could be wrong on that.
the main point is the link DOES work in IE and according to Victor in later versions of Opera, so it prob is a bug that i'll best get around by either using IE when i'm working with this until i upgrade opera.