UPDATE after message from chrwahl:
I am reading a SVGZ file into an object and I need to get the contents of #document.
This is the code I am using to it:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<object data="https://outserver.com/1234567.svgz" id="svgholder" type="image/svg+xml"></object>
<script>
var svgholder = document.getElementById("svgholder");
svgholder.onload = function () {
console.log(svgholder.contentDocument.documentElement);
}
</script>
</div>
</form>
</body>
</html>
The code will work when the SVGZ file seats on our own server but will fail when I load a SVGZ from a remote server (different domain).
The weirdest part is that the SVGZ renders finely in both cases. The only problem is when I try to retrieve the contents of #document using svgholder.contentDocument.documentElement: it will work for the local server files but not for the remote files (it says it's null).
Still more strange is that if I console.log only svgholder the #document IS there for BOTH cases, but for some reason JS won't find it when the file is loaded remotely!
Ideas?