Skip to content

Commit

Permalink
Uses Iframe instead of injection.
Browse files Browse the repository at this point in the history
  • Loading branch information
BusyBird15 authored Dec 13, 2024
1 parent 860b4e4 commit 057574c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions utility-pages/transparent-svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
top: 0;
left: 0;
}
svg {
iframe {
height: 100%;
width: 100%;
object-fit: fill; /* This will disregard the aspect ratio */
border: none;
background: transparent;
}
</style>
</head>
<body>
<div id="imageContainer"></div>
<div id="imageContainer">
<iframe id="imageIframe"></iframe>
</div>

<script>
function getImageURL() {
Expand All @@ -39,13 +42,8 @@
function loadImage() {
const imageURL = getImageURL();
if (imageURL) {
const imageContainer = document.getElementById('imageContainer');
fetch(imageURL)
.then(response => response.text())
.then(svgContent => {
imageContainer.innerHTML = svgContent;
})
.catch(error => console.error('Error loading the SVG:', error));
const imageIframe = document.getElementById('imageIframe');
imageIframe.src = imageURL;
}
}

Expand Down

0 comments on commit 057574c

Please sign in to comment.