I'm seeing the same problem in both Chrome 15.0.874.106 m, and in Safari
5.1.1, so maybe a general Webkit issue?
A workaround seems to be to create the object using DOM createElement, set its
data attribute, and then append it to the document, like:
var d = document.getElementById("divone");
var obj = document.createElement("object");
obj.setAttribute("id", "test");
obj.setAttributeNS(null, "data", "animate.svg");
obj.setAttributeNS(null, "width", "800px");
obj.setAttributeNS(null, "width", "600px");
obj.setAttributeNS(null, "type", "image/svg+xml");
d.appendChild(obj);
--- In [email protected], Raks A <rakssvg@...> wrote:
>
> Hi,
>
> I have a requirement of embeding a SVG document dynamically with javascript
> inside a HTML. For this I had a <object> element with a blank "data"
> attribute and then I set this data attribute with javascript.
> While this works fine in Chrome and FireFox it does not work in Safari (
> and other AppleWebKit browsers ). Safari is not sending a HTTP request when
> the data attribute is being set. I even tried jquery to set the data
> attribute but still it wont work in Safari.
>
> Any one aware of this issue with Safari. Following is my code. I have tried
> setAttribue, c.data, as well $("#test").attr(), none of them works in Safari
> and all of them works in Chrome and FireFox
>
>
> <html>
> <head>
> <script type="text/javascript">
> window.onload = function(){
> c= document.getElementById('test');
>
> c.setAttributeNS(null,'data','http://myserver.com/SVG/MyImage.svg');
> }
> </script>
> </head>
> <body>
> <object id="test" data="" type="image/svg+xml" width="200"
> height="200" />
> </body>
> </html>
>
>
> [Non-text portions of this message have been removed]
>
------------------------------------
-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/