JSRoot json not working

Dear all,
I am trying a dummy webpage where I want to display a JSON root plot.
If I open in the browser this link (adjusting my_local_ip): http://my_local_ip:8080/Canvases/c1/root.json

I do see the json object, so something is wrong in the following HTML code, any suggestions?

 <!DOCTYPE html>

 <html lang="en">

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>Reading object from the JSON file</title>
<script type="text/javascript" src="https://root.cern/js/latest/scripts/JSRootCore.min.js"></script>

<script type='text/javascript'>
  // json file stored in same folder, absolute address can be used as well
  JSROOT.NewHttpRequest("http://my_local_ip:8080/Canvases/c1/root.json", 'object', function(obj) {
     JSROOT.draw("drawing", obj, "hist");


Seems to be you have CORS problem (check in developer tools of your browser).
You should see message like “Cross Origin Requests not allowed”

Reason is that on the page, which is hosted on your web server,
you tries to access data from other web server (THttpServer in your case).

There are several possible solutions:

  1. since ROOT 6.10 there is possibility to enable CORS headers when starting http server.

    new THttpServer(“http:8080?cors”);

  2. Install special plugin in your browser.
    For the Firefox it is CORS Everywhere plugin:


Correspondent plugin for Chrome:



another possibility:

I wrote this little web server for a colleague who had the exact same issue.
it’s using Go, but you could presumably write it in python too.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.