Last active
March 22, 2019 22:11
-
-
Save bsoule/99013d73cc652e8bf08a45103db65ee8 to your computer and use it in GitHub Desktop.
object error event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>test object svg reload</title> | |
</head> | |
<script> | |
let beeurl = "https://www.beeminder.com/legacy_images/infinibee.svg" | |
let noturl = "https://beeminder-dev.s3-us-west-2.amazonaws.com/not-a-valid-file-name.svg" | |
let svgurl = "https://s3-us-west-2.amazonaws.com/beeminder-dev/graphwith.svg" | |
function updateSVG(url) { | |
let svgObject = document.getElementById("graph") | |
svgObject.onload = () => { | |
console.log("loaded object") | |
} | |
svgObject.onerror = () => { | |
console.log("error object") | |
} | |
svgObject.setAttribute("data",url) | |
svgObject.parentNode.replaceChild(svgObject, svgObject) | |
} | |
</script> | |
<style> | |
body { text-align: center; } | |
</style> | |
<body> | |
<div class="panel"> | |
<div class="main"> | |
<object type="image/svg+xml" | |
data="https://www.beeminder.com/legacy_images/infinibee.svg" | |
id="graph"></object> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment