CodexBloom - Programming Q&A Platform

HTML5 Canvas not rendering correctly in Edge 112 when using SVG images

👀 Views: 2 💬 Answers: 1 📅 Created: 2025-06-06
html canvas svg edge HTML

I'm stuck on something that should probably be simple. I'm sure I'm missing something obvious here, but I need some guidance on I'm collaborating on a project where I've been working on this all day and I'm working on a personal project and I've been banging my head against this for hours... I tried several approaches but none seem to work... I'm experiencing a frustrating scenario with HTML5 Canvas where SVG images are not rendering as expected in Microsoft Edge version 112. The canvas displays correctly in Chrome and Firefox, but in Edge, it appears as just a blank space. I've ensured that the SVG files are accessible and correctly formatted. Here's a simplified version of my code: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Canvas SVG Test</title> </head> <body> <canvas id="myCanvas" width="500" height="500"></canvas> <script> const canvas = document.getElementById('myCanvas'); const ctx = canvas.getContext('2d'); const img = new Image(); img.onload = function() { ctx.drawImage(img, 0, 0); }; img.src = 'path/to/image.svg'; // SVG image path </script> </body> </html> ``` In Edge, I also checked the console for any errors, but I only see a warning: `SVG image not fully supported in the current context.` I’ve tried using `setAttribute('crossOrigin', 'anonymous')` before setting the `src`, but that didn’t resolve the scenario either. Is there a known limitation or workaround for rendering SVG images on HTML5 canvas in Edge? Any ideas what could be causing this? For context: I'm using Html on Windows. Any help would be greatly appreciated! I'm developing on macOS with Html. What would be the recommended way to handle this? This is part of a larger web app I'm building. I'm using Html 3.9 in this project. What are your experiences with this? I recently upgraded to Html 3.9. Any ideas how to fix this? This is for a application running on Ubuntu 20.04. Thanks for your help in advance!