hi i m not able to load an image in chrome using img src="E:\pic1.jpeg" when i run this code in internet explorer its working bt not in chrome . on the other hand when i give the name of image instead of path in src then its working ...
plz help ... regards Prabjot
Chrome probably doesn't handle file system paths (or at least not without using file://). Even if this did work, that link would only work on your local machine as the person browsing your website wouldn't have an image at that location.
You should be using URLs for your resources (i.e. images), not file paths.
Have you tried using file:// to prefix your image local path?
Related
I am looking for suggestions on how to reference a local image file in HTML. The HTML code will only ever be used locally and never be published on a network of any type. I find that this code
<img src="file://l:/Test FFHP data/1042545.tif">
works well in Internet Explorer and Edge. It does not work at all with Chrome or FireFox.
Please give me some direction. I am hoping my users will be able to use their preferred browser.
I am trying to display a document in the browser using a html link which has this form :
filename.pdf
I already tried to use file:// , file:/// , file:\\ , and file:\\\ , but I always have the same error :
Not allowed to load local resource: file://...etc
The strange thing is that it is working on one computer (with google chrome) when the extention "LocalLinks" is installed but not on the others computers (with the same extention installed).
It is working on all computers when I directly paste the file path in the URL, the only problem is when using the link to open it.
I don't understand the issue.
Your Best bet would be to store it in a folder relative to the served HTML file. Because different Web Browser's use different protocols.
Here are some other more in depth answers:
How can I create a link to a local file on a locally-run web page?
I am making a web application using ASP.NET and I noticed that only Internet Explorer loads images properly that are on my home computer (../Desktop/WebsiteImages/xxxx.jpg), whereas the images won't load on Chrome or Firefox. If I want the images to display on Google Chrome or Firefox, I have to upload the images on a web hosting site such as imgur instead of having them all on a file on my computer. Is this a known bug?
If I want the images to display on Google Chrome or Firefox, I have to
upload the images on a web hosting site such as imgur instead of
having them all on a file on my computer. Is this a known bug?
It is not a bug.
Web Server will never serve a file which is located outside of a web application (unless you create an image handler by yourself).
If you are new to web application, easiest way is to place images inside ~/images/ folder inside your ASP.Net application.
Then you can call the image like this -
<img src="#Url.Content("~/Images/MyImage.jpg")" alt="My Image"/>
showing local file like file:// is not allowed in Chrome and Firefox for security reasons by default, but this answer shows you how to change those settings. it's not recommended to use local filepath for your image
Could anyone tell me why mozilla firefox unable to display the images where explorer can do? I even changed the extension with CAPs in all ways i can but not yet working. I have written a HTML file and my IE can open in the way i want but when i open my HTML file using the mozilla it is not displaying images but just leaving the image borders.
And also IE can reference to the CSS sheet path and making the changes but wheareas the mozilla its unable to link with css sheet path I have set the text color and font size in my css sheet and linked it with my html file. Its working perfect in IExplorer but not with the mozilla. I have been asking these thing How do i make a standard HTMl file that works on every browser And i got some answers from you but still I am unable to make it work .Can anyone tell me a good document to go through because no matter how i try its working on one browser and throwing the error on some other browser
Im giving it as src="d:\text\image.png"
If you are using absolute paths with drive letters, e.g. <img src="C:\www\images\foo.png" alt="foo">, it will work with Internet Explorer but not with Firefox. If you include drive-letters etc. in the path, the path becomes Windows specific, something that IE can understand but other browsers may not.
To fix the problem, you should use relative paths, e.g. <img src="images\foo.png" alt="foo">. The path should be relative to the HTML file where this code is present.
Most often, web pages are written to be hosted on web servers. Images are usually put under an 'images' directory inside the document root (web-root), say, /images/foo.png. Now, the home page at /index.html can include this image either using a relative path: <img src="images/foo.png" alt="foo"> or an absolute path (path from the document root): <img src="/images/foo.png" alt="foo">. Note the usage of forward-slash as opposed to back-slash. You should use forward-slash. Back-slash is very Windows specific and other browsers may not understand it.
The same applies for CSS or any other paths used in your HTML documents.
For me worked (for Mozilla Firefox v 26.0).
<img src="file///C:/User/MrBrown/www/images/foo.jpg">
Didn't worked:
<img src="C:\User\MrBrown\www\images\foo.jpg">
instead of specifying the path as src="d:\text\image.png"...
change the path as src="file:///D:/text/image.png"
if the folder name are having spaces.. then instead of spaces, write %20. or else open that image file in any of the web browser.. and copy the address from the address bar and paste that address as src path..
it will work for both Google chrome and firefox..
How to open jpeg in jsp file using Mozila Firefox? It works in IE but can't run in Firefox by passing it's scr tag dynamicaly
It will say E:\stxavier\docs\7.jpg
e not protocol error
and without generate dynamic content it will see path like
e|\stxavier\docs\7.jpg
So I can't understand that meaning I also use this thing but my other link to pdf or avi file is lost
To link to a local file, like "E:\stxavier\docs\7.jpg" you should prepend the local path with "file:///".("file:///e:/stxavier/docs/7.jpg")
But even if you do this Firefox and Opera sometimes DO NOT ALLOW links to the local file system.
Sometimes it will work sometimes it will not, you just can not relly on links to local files.