Hi, your program never defines and registers a handler for the browser to get the PNG file from the server. You essentially only serve test2.html. If you take a look at the developer console on the browser (network tab) and reload the page you'll see that "blank grey.png" will be the same size as test2.html. That's because your server always returns test2.html for any request... registering "/" is essentially a catch-all if no other routes are defined.
Chris On Thu, Feb 24, 2022 at 01:27:41PM -0800, buzze...@gmail.com wrote: > This little program (attached: weird1.go) reads a small file of html code > and delivers it through the golang webserver to a browser. The html code > (test2.html) defines a box which it fills with an image ("blank grey.png"). > > If you point the browser to the html file, the image is correctly > displayed. If the go program reads the same file and sends it to the > browser through the webserver on localhost:8080, the html is displayed > correctly except that the image is omitted. If you do a copy of the > 'view-page-source' for the incorrectly displayed htm and present it to the > browser as a file (identical to the original html file) the image is shown > correctly. What is wrong? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/8e262895-95de-4bdf-ab60-0f168ce7455cn%40googlegroups.com. > -- Nothing to see here. Move along. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/YhgKAmC9FZnbdmWA%40chusuk.dune.