c00000fd
c00000fd

Reputation: 22293

Img tag with local file:/// URL is not shown in the Microsoft Edge web browser

In my desktop application I create a temporary HTML file (that is designed to let users print a report) that is then displayed via a default web browser. This HTML file is saved in a temp folder, for example: C:/Users/UserName/AppData/Local/Temp

This works in all web browsers (surprisingly even including IE) but Microsoft's another creation, Edge, gives me a blank image icon

enter image description here

for the following:

<img width='24' height='24' style='border: none;' alt='Print'
src="file:///C:/Users/UserName/AppData/Local/Temp/printicon.gif"></img>

Any idea why this fails?

PS. Obviously that gif file exists and is openable.

FOLLOW-UP: Upon further testing, I discovered the reason why Edge was blocking my image. I added the following to the top of the HTML mark-up

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0038)http://www.samplewebsite.com/index.htm -->
<html>
<head>

to prevent IE from showing this:

enter image description here

Mind you, the reason for that message was just this line of code for the "Print" button:

javascript:window.print();

So if I remove the <!-- saved from ... --> line, Edge seems to display my images. But I obviously can't do it, because I need it to work with older IE.

Upvotes: 2

Views: 5969

Answers (2)

wiseCoder
wiseCoder

Reputation: 1

i experienced a similar issue my my-file.html had been corrupted i copied contents of my my-file.html an other .html file and the issue is solved and my image was shown it took more time than two hours :)

Upvotes: 0

c00000fd
c00000fd

Reputation: 22293

I think I got it solved (once I knew what's causing it.) Actually found this page that gave me the clue. So if I do this, it will work with Edge and IE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0016)http://localhost -->
<html>

Upvotes: 3

Related Questions