Joey Caero

posts games about

Become Batman with 1 Line of JS

Early on in the semester one of my classes made me sign up for a site where we could turn in assignments and have discussions on.

The site had avatars that you could customize, much like a mii. I was customizing mine when I noticed something strange.

Why is it that I could have the same options, yet get a different avatar?

Difference between options

If I selected the bow first the bow went under the hat, and if I selected the hat first the hat went under the bow.

It turns out this is because the server wasn't sent the options that made my mii, the server got sent a picture of my mii. The picture looked different depending on which option was drawn first.

I hit F12 on my browser and drew my own picture:

var i = new Image(); i.src = "<imgurl>";
document.getElementById("canvas-id").getContext('2d').drawImage(i,0,0,330,330);

The server trusted the client to send good data. Now the client is batman.

Become Batman