Code and Stuff

Feb 20, 2013


EPrints supports JSON-P. It is therefore possible to include a list of publication with javascript on a different host without the need for the CORS headers.

Here an example using SUPSI's eprints repository. List of publications with creator being david huber:


    You will need the url to the JSON export of the desired search. In other words: perform the search, choose to export as JSON and copy the url. In my case the url was:

    Append to that url the JSONP part:

    Replace functionName with any desired function name. As expected by JSONP, the new URL will return a javascript that can be used with a script tag and will pass to functionName an array of publication objects.
    <script type="text/javascript" src="the JSONP URL"></script>
    This script tag can also be injected in the DOM when needed. For instance at DOM ready with the following JQuery code:
    // execute when DOM is ready
    $(function() {
      $(document.body).append("<script type='text/javascript' src='the JSONP URL'></script>");

    No comments: