Possible Duplicates:
Javascript toSource() method not working Implementing Mozilla’s toSource() method in Internet Explorer.
Is 开发者_开发问答there an alternative method toSource for internet explorer?
toSource
is non standard and works in the gecko engine only, so will not work in chrome, safari or IE.
See this SO question and answers.
It is not the same as toSource()
but json2.js has JSON.stringify()
which will convert a JavaScript object to JSON. This won't convert everything that .toSource()
will. It doesn't for instance deal with functions.
精彩评论