Wednesday, February 23, 2011

Issue : dojo.xhrGet fails in Safari

It was one trouble some situation when I found that my dojo.xhrGet failed in Safari. I felt like I was hanging in a cliff 500 feet deep. with no way back :( untill I stumbled upon the following forum discussion,

An amazing one. The first few posts are not visible for some reason but the vital ones that resolved the issue where visible.

The abstract of what I understood from issue that I faced and the discussion in this forum are as follows,

1. When using dojo.xhrGet, a preflight request get triggered from safari. And that means an Ajax request is triggered to the server before server authentication could occur. And this posed a severe security threat as Anonymous access to my Lotus Notes Database has to be enabled for dojo.xhrGet to work on Safari.

2. The trick was to use dojo.xhr instead of dojo.xhrGet . The documentation on  dojo.xhr can be found in the following location -

3. The context that we need to understand here is that dojo.xhrGet({arguments}) is same as dojo.xhr("GET",{arguments}). And this is one of the vital points that resolved the issue

In addition to the above, to tackle the preflight request issue, it is better, if one can check on the play around with the "sync" flag. It is not that playing around with this will definitely resolve the issue but there are paucity of chances that it might help.

Hope this helps :)

No comments:

Post a Comment