javascript - Cross-domain SVG content document in object tag -
Is it with a 'SAGG' with data in a foreign domain (data = "// da86ge957603k.cloudfront. Net / rails / grafitti_logo-f4e8238a87c979c0cf5b41481c982b71.svg "), and then bind a load event into the object and then access the SVG Dom of the object through the Content Document Properties? I can do this when SVG is at the local domain, but whenever I try to host SVG elsewhere, I get the error "This content document is empty" error. I've tried the getSVG document () as well but I'm not getting anywhere, which says it's a cross-domain security issue, and I can tell that SVG (I do not use an IFrame The object used) should be allowed with the tag. I appreciate you that you are taking the time to help me here is the code that I am using to embed and tie the object, and I try to reach the DOM (as I said when SVG is on the local domain).
& lt; Object id = "gangster graffiti" type = "image / svg + xml" data = "& lt;% = image_url (" grafitti_logo.svg ")%>" & Gt; Gangster & lt; / Object & gt; $ ("#GongsterGraphy"). Each (function () {this.addEventListener ('load', SVGGGGGraphReady, false);}); Function svgGangsterGraffitiReady () {var graffitistrokes = this.contentDocument.getElementsByClassName ('graffiti'); (Var i = 0; i & lt; graffitistrokes.length; i ++) {graffitistrokes [i] .setAttribute ("stroke", "white"); Graffitistrokes [i] .setAttribute ("fill", "white"); }} donation
This document contains By means of a & lt; Object & gt; Can not access cross domain in tag data You need a remote location (if you can) and have to score it
Comments
Post a Comment