The Universalis server provides some of its content in JSONP format.
The way JSONP works is this:
universalisCallback, but you can use a different name if you want.
Here is an example of a page which incorporates Universalis content. (It is on a separate site from Universalis because your own web pages are on a separate site from Universalis, and we wanted to show you that the mechanism works even in that case).
Once you have looked at the example page, you can view its source code and copy it into your own pages. The source code contains many comments, labelled "CUSTOMISATION", which explain what changes you may want to make to our example code.
As for creating your web page, you have to be able to include a couple of
<script> tags into the HTML code, and also (for the simplest case) to set the
id value for some of your page elements. All HTML editors let you do this easily, but you may run into trouble if you are using something like Wordpress because (depending on its settings) it can restrict the tags you are allowed to use.
What happens when the user views the web page is this:
<script>tag, so that it can execute it.
universalisCallbackfunction. The call passes your function a JSON object which contains the data from Universalis.
universalisCallbackfunction extracts the items it wants from the JSON object it has been given, and puts them into the appropriate parts of your web page.
The example page handles the simplest case, when you want the Gospel for today, according to a fixed calendar and time zone.
You can change the
jsonpmass.js request to include next Sunday's date in the URL (for instance,
/20130609/ for Sunday 9 June 2013). However, you would have to edit your web page each week to change the requested date.
You can include both today's and next Sunday's Gospel on the same page by having two
jsonpmass.js requests on the page, referring to two differently-named
universalisCallback functions and two different sets of
Instead of using a built-in
<script> tag to request
jsonpmass.js, you can synthesize a
Yes, it is possible, though the documentation appears sparse. Stack Overflow has an example which might serve as a starting-point.
|This website © Copyright 1996-2013 Universalis Publishing Ltd (contact us)|