BlogMatrix
 

Move JSON data loading into the browser

edit David P. Janes 2006-10-26 09:38 UTC add comment  ·  ·

Douglas Crockford proposes that loading JSON documents be moved directly into the browser, in much the same way that XMLHttpRequest is. There are many advantages to this (which Crockford outlines) including increased security and the fact that JSON has become the way to load data into the browser for AJAX applications.

We've done similar work here using the SCRIPT tag to do cross site JSON loading. Crockford's proposal would obsolete this (and we'd be happy about it).

You can read the proposal here. Hopefully some bright Firefox and IE gurus will pick up the torch for this one.

Internet Explorer and dynamically changing img.src

edit David P. Janes 2006-10-15 07:30 UTC 8 comments  ·

We slipped a photo album extension into the product on Friday; you can see one right here. Unfortunately, it doesn't always work on Internet Explorer -- the image sometimes displays as blank.

The explaination is here:

The issue is that changing the 'src' attribute of an <image> tag, is making the image disappear, rather than change. Frustratingly, the problem only happens in IE; Gecko behaves as expected.

I have found two work arounds: one is to pop up an alert just after chainging 'src': the icon image correctly updates when the alert dialog is popped up (before dismissing it). The second is to use a callback with the 'setTimeout' method. The first is unacceptable, the second is, IMHO, simply ugly.

We went with the setTimeout method, obviously:

onclick : function(index, again) {
    if (document.all && !again) {
        window.setTimeout("i$(ID).onclick(" + index + ", 1)", 1)
    }

Note to self

edit David P. Janes 2006-09-27 10:23 UTC add comment  ·  ·  ·

Frequently test against Internet Explorer.

Javascript debugging in Internet Explorer

edit David P. Janes 2006-08-07 20:28 UTC 1  comment  ·  ·

While attempting to debug a nasty session/cookie problem under FireFox I decided to give V10 a view under Internet Explorer. And immediately ran into a nasty Javascript compatibility problem.

IE's native Javascript debugging capabilities are pretty well non-existent. Fortunately, it's pretty easy to set up:

  • Install the Microsoft Script Debugger (you may have to go through the Windows Genuine Advantage process first)
  • In IE, do Tools > Internet Options; then under the Browsing section unselect the two Disable Javascript... items (about 4 items down)

Now when you get a Javascript error, it will prompt you to go into the debugger which in my case, brought me immediately to the error. What was the error? In JSON-style mapping datastructures, don't leave trailing commas. It no work.

Differences between browsers

edit David P. Janes 2006-07-12 11:50 UTC add comment  ·  ·

A few notable differences between Firefox and Internet Explorer (v7 beta) for this website:

  • There's supposed to be a diagram in this post (works on IE, not FF)
  • The sidebar is supposed to have little dividing lines, not huge white bars (works on FF, not IE)

We're planning to go "really" live soon, so no rest for the weary.