mako mako - 2 years ago 88
HTML Question

How to externalize json-ld and include in html doc

Is it possible to externalize json-ld and include it in an html document like this:

<script type="text/javascript" src=""></script>

There doesn't seem to be any documentation about this online....

Answer Source

You can't do that. You should get the json with an AJAX request.

You can do it easy with jQuery


  $.getJSON("data123.jsonld", function(data) {


 <div class="json"></div>

If your json file is not in your file system (cross domain) you should try something like this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download