☑ 404 Loading Asset From HTML

Hey, I just noticed some of my code that used to be working has recently started to fail. The code is related to displaying an image in HTML user interface elements. My code used to display the asset fine, but now I’m always getting a 404 from the server. I suspect this is related to the change from HTTP to HTTPS on the playcanvas server with, perhaps, the file server not expecting the HTTPS prefix (this is all just theoretical in my head) as the same request used to work fine.

It could just be a simple code error on my part too, or a change that I need to make that I’m unaware of. The code used to work fine but it’s been a while since I was playing with it.

I’ve created a small reproduction project (located: https://playcanvas.com/project/452109/overview/test-html-image).
Thanks for any info!

One issue I do see is you are using asset.file.url but you should use asset.getFileUrl() instead. Try that change and let me know if you still have issues.

1 Like

Hey, yes you’re totally correct. That works if I update the code to use getFileUrl()!

Many thanks!