Client-side SFX integration with jQuery-Ajax (YQL)
Tags: 00code00
, ajax
, javascript
, jquery
, opac
, sfx
Last Updated: Jul 20, 2010 13:35
- Description
While Javascript XSS queries are forbidden by default, we use client-side scripting in two ways: piping requests through a cgi proxy script, and using the Yahoo YQL API (returns the SFX response as JSONP-X, which overrides the browser XSS restrictions). This page describes the latter option (YQL).
- Author: Daniel Zimmel
- Additional author(s):
- Institution: Max Planck Gesellschaft
- Year: 2010
- License: BSD style
- Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
- Link to terms: [Detailed license terms]
- Skill required for using this code:
intermediate
State
Stable
Programming language
Javascript
Software requirements
jquery.js (http://www.jquery.com/), third-party plugins (see code).
Makes use of the Yahoo YQL API (http://developer.yahoo.com/yql/)
Screen captures
Place your screen shot here...
Author(s) homepage
Download
see code below
Working example
http://aleph.mpg.de/F?func=direct&doc_number=000000323&local_base=rdg01&con_lng=eng
Using the following interfaces
*SFX-API
*Yahoo YQL API
Installation instructions
Make the following third-party scripts available on your Aleph server:
- http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/ (jquery.xdomainajax.js)
Change the Yahoo query from "select * from html" to "select * from xml" (SFX response is XML)
- http://outwestmedia.com/jquery-plugins/xmldom/ (for IE bug) (jquery.xmldom-1.0.js)
For Jqueries, you will need CSS-Ids in your full view - we use the built-in MARC/MAB-Field plus contents variables in full-999-body:
and direct-head/full-set-head(-nobor):
Place the following code into full-set-tail/direct-tail.
You will need to customize the Jquery-Id-Selectors to the headings in col.8 in edit_doc_999 – they are used by Aleph in full view as internal variable $0200. Change "my.sfx.server" to your SFX server url.
TO DO list
Text...
Known issues
Correct SFX target display works only for a given IP (because it is proxied via Yahoo). If you want to show the availability for the current client's IP, use a proxy script on your Aleph server (without YQL).
If you make a lot of queries, you might need to get an Access Key from Yahoo.
(see also YQL Terms of Service: http://developer.yahoo.com/yql/)
Comments
Text...

