# SVG texture with image linking to "object URL" does not work

**URL:** <https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076>\
**Category:** Bugs\
**Created:** [February 1, 2021, 10:26pm UTC](https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076 "2021-02-01T22:26:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjornbacklund](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bjornbacklund/32/14097_2.png) [@bjornbacklund](https://forum.babylonjs.com/u/bjornbacklund)\
**Post date:** [February 1, 2021, 10:26pm UTC](https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076/1 "2021-02-01T22:26:15Z")

</div>

Image in a SVG texture that is linking to an “object URL” does not work. Probably a CORS issue?  
Here is a Playground sample for the issue: [Babylon.js Playground](https://playground.babylonjs.com/#AYFECP)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 1, 2021, 10:31pm UTC](https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076/2 "2021-02-01T22:31:36Z")

</div>

You should simply pass the string data to `href` and not the result of `createObjectUrl`:

[https://playground.babylonjs.com/#AYFECP#1](https://playground.babylonjs.com/#AYFECP#1)

Note: you should check first that copying/pasting the value of `url` in the adress bar of a browser produces the desired result. If that does not work (as it is the case with your PG), it can’t work in Babylon neither.

---

<div class="post-metadata">

**Author:** ![bjornbacklund](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bjornbacklund/32/14097_2.png) [@bjornbacklund](https://forum.babylonjs.com/u/bjornbacklund)\
**Post date:** [February 1, 2021, 11:03pm UTC](https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076/3 "2021-02-01T23:03:59Z")

</div>

The problem is that I have really large photos and placing them in SVG as data urls is memory intensive, better keep them around as object urls (makes sense I hope).  
The sample I uploaded shows that the object URL itself can be used as a texture image but NOT when linking from within a SVG.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 1, 2021, 11:28pm UTC](https://forum.babylonjs.com/t/svg-texture-with-image-linking-to-object-url-does-not-work/18076/4 "2021-02-01T23:28:58Z")

</div>

Sorry, did not see in your PG that you already tested this possibility…

It seems linking to a picture does not work either:

[https://playground.babylonjs.com/#AYFECP#3](https://playground.babylonjs.com/#AYFECP#3)

Maybe there are some constraints when using data uri that prevent using external references…

[…] It seems it is the reason why it does not work: [html - svg in data uri not rendered - Stack Overflow](https://stackoverflow.com/questions/41727985/svg-in-data-uri-not-rendered)
