I’m working on a project that leans pretty heavily on changing fill attributes within SVGs. I’ve got a simple script working to do it which works perfectly when I preview my project.
However it doesn’t work at all when I export the project and run the exported file off my hard drive. Switching the svg for another works, but changing the fill colours no longer functions.
When I upload the exported files to a server and run it from there altering the fill colour works again, but this project is designed to run locally, not on a server…
Edit: this is the error I get in the console in Safari:
“Blocked a frame with origin “null” from accessing a frame with origin “null”. Protocols, domains, and ports must match.
“Error in changeColoursInSVG: TypeError: null is not an object (evaluating ‘svgDoc.getElementById’)”
Chrome gives me this error in the JS console:
changeColoursInSVG: SecurityError: Failed to read the ‘contentDocument’ property from ‘HTMLObjectElement’: Blocked a frame with origin “null” from accessing a cross-origin frame.
I’ve attached a test project, any help with this issue would be greatly appreciated.
SVG Test.hype.zip (29.6 KB)