Error with Chrome and Safari: Unsafe attempt to access frame with URL data:image/svg+xml...

931 views
Skip to first unread message

Mayo

unread,
Nov 9, 2010, 7:12:16 AM11/9/10
to SVG Web
I have some code (below) where I get a file via jQuery $get method.
In Firefox it works, but in Safari and Chrome I get the following
error:

"Unsafe JavaScript attempt to access frame with URL data:image/svg
+xml, <svg xmlns:svg='http://www.w3.org/2000/svg' xmlns='http://
www.w3.org/2000/svg' viewBox='0 0 200 100' width='200px'
height='100px'><rect x='60' y='20' height='60' width='60'
style='stroke:none; fill:#00ff00;fill-opacity: 0.5;' /> </svg> from
frame with URL http://localhost:8081/MISDashboard/WebContent/Category.html.
Domains, protocols and ports must match."

Code:

function loadSVG(pSVG)
{
1. var svg = document.createElement('object', true);
2. svg.setAttribute('data', 'data:image/svg+xml,' + pSVG);
3. svg.setAttribute('type', 'image/svg+xml');
4.
5. svg.addEventListener('load', function() {
6. $("#chartDiv").html(addedRoot);
7. }, false);
8.
9. addedRoot = svg;
10. svgweb.appendChild(svg, document.body);
}

If I try "svg.setAttribute('data', pSVG);" instead of line 2. (i.e.
without the "'data:image/svg+xml,' + " bit) it doesn't work in any
browser.

Thanks for any help on this.

Bradley Neuberg

unread,
Nov 16, 2010, 5:26:41 PM11/16/10
to svg...@googlegroups.com
It seems like this is an SVG issue independent of SVG Web, is that right? On Safari and Chrome, are you using the native SVG renderers? Can you make a reduced test case that doesn't use SVG Web but just tries to create the Object and data:url and see if the issue lies in how you are building things up that way?

Best,
  Brad Neuberg





--
You received this message because you are subscribed to the Google Groups "SVG Web" group.
To post to this group, send email to svg...@googlegroups.com.
To unsubscribe from this group, send email to svg-web+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/svg-web?hl=en.


Reply all
Reply to author
Forward
0 new messages