The following applies to CFAJAX version 1.3. I don't know about previous versions, and I certainly don't know about future versions!
I've noticed that CFAJAX seems to have with Safari. I've also noticed that other people have noticed as well.
Although my chat room worked for Safari users, Safari seemed to urlencode the parameters, and cf did not decode them. Almost as if Safari URL encoded the parameters, and then URL encoded the whole XML packet.. so when coldfusion received the XML packet, it URL decoded it, and the parameters were still urlencoded. Crazy!
So a safari user would type "hey just checking this out", and it would get passed to my functions as "hey%20just%20checking%20this%20out".
Here's my solution to this problem:
In the "convertDataPassedToCFFunctionParam" function, around line 90ish, just after the <cfelse> tag, I replaced the single line that was there (that starts with <cfset variable.param = listAppend ... >) with the following:
<cfset variables.param = ListAppend(variables.param,"""" & URLDecode(Replace(Replace(mid(variables.var, variables.firstPos+1 , len(variables.var)-variables.firstPos),Chr(34),"#Chr(34)##Chr(34)#","ALL"),Chr(35),"#Chr(35)##Chr(35)#","ALL")) & """")>
<cfelse>
<cfset variables.param = ListAppend(variables.param,"""" & Replace(Replace(mid(variables.var, variables.firstPos+1 , len(variables.var)-variables.firstPos),Chr(34),"#Chr(34)##Chr(34)#","ALL"),Chr(35),"#Chr(35)##Chr(35)#","ALL") & """")>
</cfif>
Basically, if the browser is safari, URLDecode the parameter value before placing it into the list. Otherwise, don't.
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
In somewhat older versions of CFAJAX - Safari browsers were force to use the GET method in the DWREngine._sendData() method. This worked with Safari ~1.5 but not with ~2.0. In order to work with both 1.5 and 2.0 with my complex ajax calls I force it to use the POST.
I also modified the engine.js code to carry through tokenized queries (i.e. ?CFID=xxx&CFTOKEN=xxx) in all the batch.req.open() calls...
The calls automatically append a "?" + query to without regard to if the original batch.path having a ?CFID... GET string. My simple solution was:
if (batch.path.match(/\?/)) {
batch.req.open("GET", batch.path + "&" + query);
} else {
batch.req.open("GET", batch.path + "?" + query);
}
... in the DWREngine._sendData()
Just some more info - CFAJAX has worked very well for us in all respects in the live production environment!
Post a comment (login required)
