# How to load a stl from URL?

**URL:** <https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278>\
**Category:** Questions\
**Tags:** stl-loader\
**Created:** [October 30, 2020, 2:17am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278 "2020-10-30T02:17:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlanXin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alanxin/32/11380_2.png) [@AlanXin](https://discourse.threejs.org/u/AlanXin)\
**Post date:** [October 30, 2020, 2:17am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/1 "2020-10-30T02:17:54Z")

</div>

Hello developers,

As the topic, how to load a stl from URL([http://www.csmmg.com/pikachu.stl](http://www.csmmg.com/pikachu.stl));

loader.load( “[http://www.csmmg.com/pikachu.stl](http://www.csmmg.com/pikachu.stl)”, function ( geometry ) {

```
} );

```

Chrome consoled error:

> Access to XMLHttpRequest at ‘[http://www.csmmg.com/pikachu.stl](http://www.csmmg.com/pikachu.stl)’ from origin ‘[http://192.168.1.163:8081](http://192.168.1.163:8081)’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [October 30, 2020, 6:06am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/2 "2020-10-30T06:06:47Z")

</div>

You must use either your own, properly configured server, or a host that allows you to fetch assets via HTTP requests. [Here’s a bit more discussion about CORS](https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i) - long story short, your requests are blocked by the server because you’re not allowed to fetch this models.

Alternatively, you can import assets locally and ship them along with your app.

---

<div class="post-metadata">

**Author:** ![AlanXin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alanxin/32/11380_2.png) [@AlanXin](https://discourse.threejs.org/u/AlanXin)\
**Post date:** [November 2, 2020, 2:13am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/3 "2020-11-02T02:13:27Z")

</div>

Thank dude.  
Acturally, I konw about the CORS. My main question point is that it is correct if I use the url instead of the local asset files

Normally we use :

> loader.load( ‘…/models/stl/…stl’, function ( geometry ) {  
> currentObj = geometry;  
> $( “#loading\_data” ).hide();  
> } );

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [November 2, 2020, 2:16am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/4 "2020-11-02T02:16:59Z")

</div>

> [@AlanXin](#):
>
> t is correct if I use the url instead of the local asset files

Yes, 100%.

---

<div class="post-metadata">

**Author:** ![AlanXin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alanxin/32/11380_2.png) [@AlanXin](https://discourse.threejs.org/u/AlanXin)\
**Post date:** [November 2, 2020, 2:22am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/5 "2020-11-02T02:22:09Z")

</div>

Thanks, I just tried this locally by running a different server to load URL stl. It works.

---

<div class="post-metadata">

**Author:** ![rrrr\_rrrr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/rrrr_rrrr/32/7697_2.png) [@rrrr\_rrrr](https://discourse.threejs.org/u/rrrr_rrrr)\
**Post date:** [November 12, 2020, 11:20am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/7 "2020-11-12T11:20:11Z")

</div>

> [@mjurczyk](#):
>
> long story short, your requests are blocked by the server because you’re not allowed to fetch this models.

Server doesn’t block the request, the deny of service is initiated by your browser.

Another option: if you have access to CGI, ask server to fetch the file.

---

<div class="post-metadata">

**Author:** ![Daniel65](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@Daniel65](https://discourse.threejs.org/u/Daniel65)\
**Post date:** [March 21, 2024, 11:21am UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/10 "2024-03-21T11:21:07Z")

</div>

Select File \> Import. In the Import dialog box that opens, navigate to the STL file that you want to import and select it. Windows Only (Optional) - Select STereoLithography Files (. stl) from the file type drop-down list and then click the Options button.  
[Tellthebell](https://tellthebell.fun/)

---

<div class="post-metadata">

**Author:** ![manthrax](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/manthrax/32/2596_2.png) [@manthrax](https://discourse.threejs.org/u/manthrax)\
**Post date:** [March 21, 2024, 9:48pm UTC](https://discourse.threejs.org/t/how-to-load-a-stl-from-url/20278/11 "2024-03-21T21:48:20Z")

</div>

TIL stl == stereo lithography 😃
