4 ms·
There are some getters and setters in the web APIs with cheeky side effects. Presumably this one causes the canvas to be re-created, or something. Here's anothe
by MatmaRex 5y ago
There are some getters and setters in the web APIs with cheeky side effects. Presumably this one causes the canvas to be re-created, or something. Here's another good one, try it in your browser console:
location.href = location.href;
- tentacleuno 5y agoYour trick doesn't work for me in Firefox 96 :) One more: If you set an image's src attribute to the same thing, it'll still reload the image. const image = new Image("/img.png"); document.body.append(image); image.src = image.src;
- greggman3 5y agoIt might not actually reload the image but it has to fire all the events as though it did otherwise code would hang.
- tentacleuno 5y agoIt does reload the image in Firefox at least. I just tried it.
- MatmaRex 5y agoOh, it works, it's just cheekier than you think - it won't refresh the page if the URL includes a hash/fragment (such as after you clicked one of the "next" links while browsing comments here).