JSON Parse Error on Internet Explorer

前端 未结 3 1325
你的背包
你的背包 2021-01-21 02:25

I\'m using a jscript to retrieve JSON data from Flickr. Works 100% in every browsers except IE.
I\'m using the jquery each function that calls this specific function for IE:

相关标签:
3条回答
  • 2021-01-21 02:54

    You can choose a different method when using different browsers:

    choose eval in IE6, 7 choose native JSON in IE8 choose new Function in Firefox2, 3 choose eval in Safari4 eval has the same performance as new Function on the whole when you use the other browsers.

    0 讨论(0)
  • 2021-01-21 03:04

    Using the file https://github.com/douglascrockford/JSON-js/blob/master/json2.js you'll have this error: "parsing string: Line: 191 Error: Object doesn't support this property or method". the property or method is valueOf().

    I use the solution suggested in JSON2 Error / Conflict with another script

    return ((typeof this.valueOf === 'function') ? this.valueOf(): this.toString());
    instead of
    return this.valueOf();

    0 讨论(0)
  • 2021-01-21 03:17

    Parsing JSON on IE 8 and below have issues. It fails to identify JSON functions.

    Download the file https://github.com/douglascrockford/JSON-js/blob/master/json2.js Include it in your application and it should fix the problem.

    0 讨论(0)
提交回复
热议问题