Asked by:
in windows 7 and IE8,classic asp can not parse json ?

Question
-
User-410495528 posted
dim strJson,myJson strJson="{ ""access_token"":""ACCESS_TOKEN"", ""expires_in"":7200, ""refresh_token"":""REFRESH_TOKEN"", ""openid"":""OPENID"", ""scope"":""SCOPE"" }" set doc = CreateObject("htmlfile") doc.write "<meta http-equiv='X-UA-Compatible' content='IE=edge' />" set JSON = doc.frames.JSON set obj = JSON.parse(strJson) 'myJson=JSON.stringify(obj) Response.Write obj.access_token
i test in windows 7 ,and IE8,but have a little bug.
Saturday, December 5, 2020 1:23 PM
All replies
-
User1771714573 posted
Hi iisboy,
Could you descibe the bug detailed? Such as its status code, error message, reponse and request.
Have you tested it in visual studio and have you tried to switch browsers or other versions of windows?
Best regards,
Brucz
Monday, December 7, 2020 5:32 AM -
User-410495528 posted
when i test return message in below:
Microsoft VBScript Run-time Errors,erro: '800a01b6'
Object doesn't support this property or method: 'doc'
/test.asp,line 10
browser:IE8.0
OS:windows 7
when i update IE8 to IE10+,then in IE10+,my code run very good.
Tuesday, December 8, 2020 5:28 AM -
User-410495528 posted
Hi iisboy,
Could you descibe the bug detailed? Such as its status code, error message, reponse and request.
Have you tested it in visual studio and have you tried to switch browsers or other versions of windows?
Best regards,
Brucz
Do u understand ,Brucz?
Thursday, December 10, 2020 3:05 AM -
User1771714573 posted
Hi iisboy,
It took me long time to test it and find solution. Sorry for late reply.
The error code is line 10:doc.write "<meta http-equiv='X-UA-Compatible' content='IE=edge' />", not set doc = CreateObject("htmlfile"). But when I tested it in visual studio, all work well. I don't think it is a problem of code.
You just need to change the identity of application pool to local system, it can work whether IE 8 or 10.
Best regards,
Brucz
Monday, December 14, 2020 9:35 AM -
User-410495528 posted
Brucz
Hi iisboy,
It took me long time to test it and find solution. Sorry for late reply.
The error code is line 10:doc.write "<meta http-equiv='X-UA-Compatible' content='IE=edge' />", not set doc = CreateObject("htmlfile"). But when I tested it in visual studio, all work well. I don't think it is a problem of code.
You just need to change the identity of application pool to local system, it can work whether IE 8 or 10.
Best regards,
Brucz
maybe i make a mistake screenshot. the error code in 11:"set JSON = doc.frames.JSON".
if u not in win7,in 2012 server +, or win7 in IE10+,my little code run very well.i use your way to change the identity of application pool to local system,Everything as before.So i guess my win 7 or IE8 not support the method "doc.frames.json",the code must run in IE10+.thanks again for you help me ,I thank you from the bottom of my heart.
Monday, December 14, 2020 3:22 PM -
User-410495528 posted
I find some article later ,then i at last find a Real reason.
Chrome 23, IE 10, and Safari 6 were the first browsers to fully support ECMAScript 5.
Internet Explorer 9 does not support ECMAScript 5 "use strict".
So,if u not use IE10,then the browser will not support ECMAScript 2009, also known as ES5.
the same time ,JSON.parse() will not run in browser ,because JSON.parse() is a ES5 Features.
Monday, December 14, 2020 4:09 PM -
User1771714573 posted
Hi iisboy,
I tested it in win7 and IE 8, win7 and IE 10, all screenshots came from it.
I am glad you can find the real reason.
Best regards,
Brucz
Tuesday, December 15, 2020 3:36 AM