0

I'm working on a project and I'm using a SCADA system. The system is a HTML and JS based. The code that I've written works when I run it through normal notepad++ and any browser. The images get displayed. But It seems that the SCADA system can't process the available DOM methods when images come to play. The provided short example code typically works well but the SCADA system does not allow this type of code. It returns this type of error GET http://localhost/EMACS/$GLOBAL_RESOURCE$Neon_sun.svg 404 (Not Found) It only displays an image when it's strickly provided in the body of a html file within the img tag but not when I run it through a script. Now, is there a way that I can execute my script and as the result of it an image will be returned and displayed in the html file as a img tag? So, to recap the short code does not work in this case, is there a workaround?

let myimage = new Image(200,200);
myimage.src="exampleimage.svg";
document.getElementById("insertimage").appendChild(myimage);

nor this:


var myimage = document.createElement("img");
myimage.setAttribute("src", "exampleimage.svg");
...
ukulele
  • 79
  • 10
  • 3
    What? This is the most basic way of displaying an image. The issue here doesn't seem to be that the image isn't working, its that the image _isn't found_ and therefor you get an error. You won't solve that issue with JS, thats your server not having anything available at that path, or it simply refusing to serve images. – somethinghere Oct 16 '19 at 09:51
  • `http://localhost/EMACS/$GLOBAL_RESOURCE$Neon_sun.svg` looks weird, especially that it appears to still contain a variable/placeholder? Assuming you only set `Neon_sun.svg` as the image source here, first guess would be that this is due to a wrongly configured URL output in a `base` element or something. You say it works if the image was part of the HTML to begin with - does that mean with the exact same path, ``, it actually works then? Is that JS code passed to the frontend exactly as you’d written it, or does it maybe get parsed & manipulated by that SCADA thingy? – 04FS Oct 16 '19 at 10:56
  • Yes, '''''' works just fine, the error pops up in the devtools console only when the script is run. The script does everything it should do, apart from displaying the images. It might be a built-in flaw of this SCADA system. – ukulele Oct 16 '19 at 12:49

0 Answers0