0

I have a question about Javascript I ran into a problem with it.

Currently, I am making a game. It's going very well. But when I try to get the src of a image on this way

document.write(document.getElementById('a').src);
<img id="a" src="img.png">

it always gives me the FQDN (http://example.com/path/to/file.png), but I entered it without it. It is very difficult to do some server based checks (because I use the / as delimeter)

Does someone know why this is expected behaviour and how to change the src attribute in JavaScript to the filename instead of the FQDN?

Koen Hollander
  • 1,596
  • 6
  • 21
  • 33

0 Answers0