Why doesn't Safari decodeURIcomponent() a URI-encoded piece of JSON automatically, like Firefox?
I'm passing a URI-encoded JSON string from secure iFrame to a non-secure grandparent iFrame. When it reaches the parent, I parse it using YUI's
YAHOO.lang.JSON.parse()
In Firefox, this works perfectly, and my string looks like
"{\"CntctNm\":\"Mike\",
In Safari, it looks like
"{%22CntctNm%22:%22Mike%22,
and
YAHOO.lang.JSON.parse()
chokes.
So, how viable is my hackaroun开发者_如何学Cd of looking for URI encoding, and decoding the string if I find it?
if(JSONstr){
secrJsonResp.indexOf("22:%22")>-1;
var updtJsonObj = Cmn.ParseJSON(decodeURIComponent(JSONstr));
}else{
var updtJsonObj = Cmn.ParseJSON(JSONstr);
};
精彩评论