Saturday, 14 November 2009

Workaround for an issue with dojo.io.iframe.send

« Html view plugin for dijit.Editor | Main | Spring »

I've developed a widget to retrieve and update a rating in an application that resides on another domain. Due to this cross domain requirement, I had to exploit the iframe hack, which dojo toolkit implements in the dojo.io.iframe module.
It works perfectly with Firefox but I was experiencing a problem with IE 7 and Safari 4: the update went well only the first time the widged is used, afterwards no other requests were sent to the target application.

At the end I've understood that I need to create the communication iframe for every request, this is my workaround:

if ((dojo.isIE || dojo.isSafari) && dojo.io.iframe["_frame"])
{
  dojo.destroy(dojo.io.iframe['_frame']);
  var frameName = dojo.io.iframe._iframeName;
  dojo.io.iframe["_frame"] = window[frameName] = null;
  if (window.frames)
    window.frames[frameName] = null;
}
dojo.io.iframe.send(...)

Check my post to dojo-interest group for any update about this topic.

Technorati Tags:

Posted by Nicola Piccinini at 5:52 PM CET in devel/