Print

Print


IIRC, this hack doesn't work in older versions of IE unless you remove the
type="text/javascript"
attribute.

(see http://openly.oclc.org/jake/instant.html )

this is one example of the few examples of a choice you have to make
between having something work and having your page pass strict
validation.

Eric

At 2:59 PM -0400 5/14/07, Jonathan Rochkind wrote:
>For what it's worth, I've used that same weird SCRIPT hack to insert
>dynamically generated code onto my OPAC screen for other purposes too.
>It was initially suggested to me by Dave Pattern. It's a useful hack.
>
>Jonathan
>
>Altay Guvench wrote:
>>Hi Godmar-
>>
>>Tim asked me to join the list and discussion on the LibraryThing widgets.
>>
>>You're right that, with Ajax, we're bound by the same-origin restriction.
>>But we can dynamically change the page content after loading, by
>>eschewing
>>traditional Ajax.  New content is delivered through dynamically-inserted
>><!cript> tags.  For example, you can set an onclick that adds a tag like
>>this to the <head>:
>>
>><!cript src="http://www.libarything.com/get_content.php?tag=foo"
>>type="text/javascript"></script>
>>
>>Server-side, get_content.php generates the response on the fly, e.g.
>>echo "
>>document.getElementById('tagbrowser').innerHTML = 'books tagged
>>foo'".  As
>>long as the response header in get_content is set to javascript, the
>>browser
>>should interpret it correctly.
>>
>>As for the hardwired DOM finagling you saw in Danbury's OPAC, in most
>>cases,
>>the table[3] stuff isn't necessary.  Typically, a library will simply
>>edit
>>their OPAC's html template to include empty widget divs  ( e.g. <div
>>id="ltfl_tagbrowse" class='ltfl'></div> ) wherever they'd like the
>>widgets.
>>Then a single script tag finds those divs and inserts the contents
>>onload.
>>
>>However, there were some permissions issues with the Danbury OPAC that
>>didn't allow for this.  (They could only edit the OPAC footer.) The
>>workaround was to dynamically insert the LTFL <div>s using custom
>>javascript
>>in the footer.  That said, like I mentioned, this isn't necessary in most
>>cases.  We've tested it in a few systems, and generally speaking, our
>>widgets are DOM-agnostic.
>>
>>Altay


--

Eric Hellman, Director                            OCLC Openly
Informatics Division
[log in to unmask]                                    2 Broad St., Suite 208
tel 1-973-509-7800 fax 1-734-468-6216              Bloomfield, NJ 07003
http://openly.oclc.org/1cate/      1 Click Access To Everything