We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Access-Control-Allow-Origin loading textures

Home Forums Programming Access-Control-Allow-Origin loading textures

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #29256
    web
    Customer

    I got an issue regarding CORS policy.

    I’m loading image urls at runtime. This works without any issue when I add the images as simple html (img tag or as background-image).

    But when I try to load the exact same images via url as an texure in verge, I’m getting the “blocked by CORS policy” error. I dont quite get why this happends only for the texture loading via verge. Where is the difference?

    This is the way I’m loading the textures:
    var texture = new v3d.TextureLoader().load('http://example.com/image01.png');

    #29257

    , I’m getting the “blocked by CORS policy” error. I dont quite get why this happends only for the texture loading via verge. Where is the difference?

    When you load images from a different domain using img tag, its ok, since no JS involved. However, when you load images with Puzzles (or JavaScript), this is entirely different story.

    Chief 3D Verger | LinkedIn | Twitter

    #29260
    web
    Customer

    Okay, I see thank for the clarification. So the only way to solve this, is to either host on the same domain or add “Access-Control-Allow-Origin: *” to the server side, correct?

    Or do you know of another possible workaround?

    #29264

    So the only way to solve this, is to either host on the same domain or add “Access-Control-Allow-Origin: *” to the server side, correct?

    yep!

    Chief 3D Verger | LinkedIn | Twitter

    #45719
    core3d
    Customer

    Can you explain “However, when you load images with Puzzles (or JavaScript), this is entirely different story.” We made Verge3D as a vuejs component, it works well on same domain but when we tried to load img or gltf from another subdomain for example UI with verge3d is on live.domain.com and gltf and other files are on storage.domain.com we get CORS.
    We already setup “Access-Control-Allow-Origin: * on serverside.
    But somehow v3d is not sending headers to server.
    Can you help with that?

    Attachments:
    You must be logged in to view attached files.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.