# How to use Cesium to call kml using my own website

**URL:** https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975
**Category:** CesiumJS
**Created:** [June 22, 2020, 5:07pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975 "2020-06-22T17:07:48Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 22, 2020, 5:07pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/1 "2020-06-22T17:07:48Z")

</div>

I am new developer, I would like to use Cesium to call kml using my own html

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [June 25, 2020, 6:42pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/2 "2020-06-25T18:42:16Z")

</div>

Have you already seen our getting started tutorial here? [https://cesium.com/docs/tutorials/getting-started/](https://cesium.com/docs/tutorials/getting-started/)

This will walk you through how to set up a CesiumJS app on your own web-page. This example shows you how to load KML from a URL: [https://sandcastle.cesium.com/index.html?src=KML.html](https://sandcastle.cesium.com/index.html?src=KML.html)

That URL can be coming from Cesium ion or from your own server.

---

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 25, 2020, 7:25pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/3 "2020-06-25T19:25:58Z")

</div>

I did look at tutorial and I modified to call my kml, but they show the earth, but did not show

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [June 25, 2020, 7:31pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/4 "2020-06-25T19:31:51Z")

</div>

Can you check your browser console to see if there are any console errors? And can you share the code you’re using to load your KML?

---

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 25, 2020, 9:03pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/6 "2020-06-25T21:03:33Z")

</div>

i try to cut and paste on reply but I dont know how do not show

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [June 26, 2020, 12:21am UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/7 "2020-06-26T00:21:47Z")

</div>

You can paste code in here by using three backtics:

```auto
your code here

```

Which should look like this:

 ![image](https://global.discourse-cdn.com/cesium/original/2X/8/875b13fc60f4b933fb09919601f8abb0cc28a30a.png)

How are you hosting your KML file? You must be able to download the KML file by visiting that URL in your browser. If that is successful, you can pass that URL to your CesiumJS app.

---

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 26, 2020, 1:43pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/8 "2020-06-26T13:43:15Z")

</div>

```auto
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
   <script src="https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Cesium.js"></script>
  <link href="https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
  <div id="cesiumContainer" style="width: 1400px; height:1000px"></div>
  <script>
    Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxM2Y5N2Y4MC04ZDNiLTRjZDYtOWU1YS0xOGJmZGJiNmM0MjUiLCJpZCI6Mjc2NjksInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1ODk4OTcyOTJ9.nvQKut6c52mGAzQPKPq_Jm8vI2tQmcchkR8P6WxJchA';

var viewer = new Cesium.Viewer("cesiumContainer");
var options = {
  camera: viewer.scene.camera,
  canvas: viewer.scene.canvas,
};

Sandcastle.addToolbarMenu(
  [
    {
      text: "KML - Global Science Facilities",
      onselect: function () {
        viewer.camera.flyHome(0);
        viewer.dataSources.add(
          Cesium.KmlDataSource.load(
            "kml/Hanoi_Box.kmz",
            options
          )
        );
      },
    },
  ],
  "toolbar"
);

Sandcastle.reset = function () {
  viewer.dataSources.removeAll();
  viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
  viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
};

  </script>
</body>
</html>

```

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [June 26, 2020, 5:17pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/9 "2020-06-26T17:17:22Z")

</div>

Does typing `https://www.<YourWebsite>.com/kml/Hanoi_Box.kmz` download the KMZ file correctly?

---

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 29, 2020, 5:41pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/10 "2020-06-29T17:41:31Z")

</div>

Here the error I got  
Content Security Policy: The page’s settings blocked the loading of a resource at [https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Cesium.js](https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Cesium.js) (“default-src”).

Content Security Policy: The page’s settings blocked the loading of a resource at [https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Widgets/widgets.css](https://cesium.com/downloads/cesiumjs/releases/1.69/Build/Cesium/Widgets/widgets.css) (“default-src”).

​

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [June 29, 2020, 5:58pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/11 "2020-06-29T17:58:03Z")

</div>

Looks like your website does not allow loading scripts from external sources, according to [https://stackoverflow.com/questions/37298608/content-security-policy-the-pages-settings-blocked-the-loading-of-a-resource](https://stackoverflow.com/questions/37298608/content-security-policy-the-pages-settings-blocked-the-loading-of-a-resource). You’ll either need to remove this restriction or host the CesiumJS library files on your own website as well.

---

<div class="post-metadata">

### Author: ![dtnguyen](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/dtnguyen/32/1987_2.png) [@dtnguyen](https://community.cesium.com/u/dtnguyen)
#### Post date: [June 29, 2020, 8:36pm UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/12 "2020-06-29T20:36:50Z")

</div>

I just point to Cesium-1.69 and I still got errors as below  
Content Security Policy: The page’s settings blocked the loading of a resource at eval (“default-src”). 2 [Cesium.js:1:582553](https://urban.jpl.nasa.gov/Ziad/Cesium-1.69/Build/Cesium/Cesium.js)

Content Security Policy: The page’s settings blocked the loading of a resource at eval (“default-src”). [Cesium.js:1:3079667](https://urban.jpl.nasa.gov/Ziad/Cesium-1.69/Build/Cesium/Cesium.js)

---

<div class="post-metadata">

### Author: ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)
#### Post date: [July 1, 2020, 2:34am UTC](https://community.cesium.com/t/how-to-use-cesium-to-call-kml-using-my-own-website/9975/13 "2020-07-01T02:34:10Z")

</div>

This error may not be specific to CesiumJS. Are you able to load any other JavaScript libraries on this page?
