The issue is about Chrome throwing Cross Domain Error on using file url
I am embedding a svg document into a HTML using the object tag with the data attribute in the form of relative path, upon onload event I want to get the SVGDocument using getSVGDocument().
I am accessing the html file using file url, when getSVGDocument is called, Chrome gives a Cross Domain Error. Chrome actually does embed the SVG but getSVGDocument does not return the DOM for the SVG
The Chrome Error is
"Unsafe JavaScript attempt to access frame with URL file:///C:/MyFiles/website/Dir1/a.svg from frame with URL file:///C:/MyFiles/website/Dir1/index.html Domains, protocols and ports must match."
As you may see the base path is same for both the html and the embedded document svg, so why does Chrome throw this error ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…