Firefox doesn't show images from a local file path

前端 未结 5 611
醉话见心
醉话见心 2020-12-22 06:01

I have used tag in html for displaying images. The image gets displayed in Internet Explorer 10, but it is not visible in mozilla, chrome. Could som

相关标签:
5条回答
  • 2020-12-22 06:56

    file:// is not allowed in Chrome and Firefox for security reasons by default, but this answer shows you how to change those settings. Really, you should set up a lightweight local server.

    0 讨论(0)
  • 2020-12-22 07:00

    i have used in jsp as this : and working in firefox and chrome

                <a href="Welcome.jsp"><img src="home.jpg">
    
    0 讨论(0)
  • 2020-12-22 07:01

    The original title to OP's question is NOT misleading - it is perfectly valid. However, they did not say whether they were using Windows or Linux. Windows and Windows programs (like DOS from which they originated) are completely indiscriminate with regard to the use of upper or lower case in filenames.

    Two possibilities to consider:

    1. Linux is fully case sensitive, including its use of filenames. Yourfile.JPG is NOT recognized as being the same as Yourfile.jpg! I recently migrated from Windows to Linux and encountered exactly the same problem with Firefox. It displayed images in sites on the internet, but not in perfectly valid local HTML and CSS markup. Later, I noticed that the Windows image-editing program I'd been using had saved all the images with uppercase .JPG or .PNG extensions. A few that I'd previously renamed manually had lowercase extensions - these DID display normally! Linux 'properties' for those files identified them correctly as JPEG files, while those with uppercase extensions were simply identified as IMAGE. Also, my markup references all images with lowercase extensions (professional usage). When non-displaying image file extensions were changed to lowercase, they all displayed correctly.

    2. If Steve is still using Windows, it's possible that Internet Explorer is displaying local images for the same reason as above. Firefox, though, uses a different engine (Mozilla) and, being open-source, maybe more strict with regards to case sensitivity in file names. However, I'm not in a position to check this out. Maybe someone else can test.

    0 讨论(0)
  • 2020-12-22 07:06

    Chrome stops access to local file:// links from with in http:// page for security reasons by default.

    0 讨论(0)
  • 2020-12-22 07:07

    The <img> tag is standard across all browsers (except text-based browsers like Lyx). That should work, however given that it is a local path it may be that you are testing it in a different environment that can't access that path?

    Review this wikipedia page on the file URI scheme and it will also highlight that some browser will limit access to local files for security reasons.

    0 讨论(0)
提交回复
热议问题