forum
forum copied to clipboard
Ability to use scripts
Discussed in https://github.com/cssbattle/forum/discussions/38
Originally posted by yass3r7 March 30, 2021 If you create a video element for instance with fake src value, it should trigger the onerror event:
<video src="fake.mp4" onerror="alert('Hello CSSBattle')"></video>
So, you can use canvas to draw the target image. But the funny thing is... you won't get 100% match haha, I got 0.5% despite the result was 100% same. So it does not make a big deal, but still I could use external images or scripts which is not allowed in your system.
example (CSSBattle number 50):
<video src="x" onerror="canvas.width = 400; canvas.height = 300;
ctx = canvas.getContext('2d'); img = new Image; img.src = 'https://cssbattle.dev/targets/50.png';
img.onload=function(){ctx.drawImage(img,0,0,400,300)}
"></video>
<canvas id="canvas"></canvas>
<style>body{margin:0}video{display:none}</style>

Thank you.