I have an SVG in my tag. When I click on it, I want to redirect the page.
<object class="SVGClass centered" data="/Data/Blue_Force.svg" type="image/svg+xml" id="BF1SVG"style="margin:20px"></object>
<script>
var SVG1 = document.getElementById("BF1SVG");
var SVGElements1;
var SVGLoaded1 = false;
if(!SVGLoaded){
SVG1.addEventListener('load',function(){
SVGLoaded1 = true;
SVGElements1 = SVG1.contentDocument;
SVGElements1.getElementById("svgCC").setAttributeNS(null, "onclick", "window.location.href='http://686amppi5.campus.nist.gov/cryoConceptsStateViewer.html'");
});
</script>
svgCC is the id of the external SVG. When i click on it, the object itself becomes the new page, like an embedded window, rather than redirecting the browser.
I've also tried:
document.getElementById("BF1SVG").setAttribute("onclick", "window.location.href='http://686amppi5.campus.nist.gov/cryoConceptsStateViewer.html'");
but that just does nothing. my svg is not clickable.