I am trying to access the SVG of the blue graph inside an iFrame on this website by opening it up in a new tab.
frames = document.querySelectorAll('iframe');
var url = frames[0].src;
var tab = window.open(url, '_blank');
tab.focus();
When this code executes, all I see is a blank page. Similarly, when I right click on the SVG and select "view frame source" and remove "view-source:" from the URL, I also see a blank page. I can, however, view the HTML inside the iFrame from viewing the original website's page source. Is there any way to fix this?
I also tried extracting the HTML using
frames[0].contentWindow.document.body.innerHTML
but it gave me an error.
The target origin provided ('https://observablehq.com') does not match the recipient window's origin ('https://d3.static.observableusercontent.com').
My understanding is that JavaScript cannot extract the HTML content of cross origin frames.
My final goal is to be able to somehow download the SVG. Would there be any other way to download the SVG?