I'm trying to get the naturalWidth property from an SVG image on IE11. I can get the naturalWidth and naturalHeight on Chrome, Firefox, and Safari but on IE11 it always returns 0.
Here is a simple Codepen that shows the issues and here is the debug view so you can execute it on IE11 (or you can just run the code below), you will see that on IE11 the width is correct but naturalWidth is always 0.
document.getElementById('mbutton').onclick = function() {
var divNatural = document.getElementById('natural-width');
divNatural.innerHTML = 'Natural Width: ' + document.getElementById('msvg').naturalWidth;
var divWidth = document.getElementById('width');
divWidth.innerHTML = 'Width: ' + document.getElementById('msvg').width;
}
<button id="mbutton">Get Width</button>
<div id="natural-width">0</div>
<div id="width">0</div>
<img id="msvg" src="https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg">
All the problems related to this point to not waiting for the image to load, which is not the case here, is this a known problem in IE11? Is there any workaround available?