Built-in JSON in Internet Explorer 8 IE8
-
Some information for reference.
Internet Explorer 8 comes with a JSON parser and stringifier built in. But I am finding it is not available on my own or other people's dialogs - the JSON object it comes back undefined.
This apparently has to do with some document compatibility modes - here is the msdn documentation on IE8 compatibility.
Of course, you can always use json2.js or eval if your application is not sharing data from untrusted sources.
-
As far as I can see, the web dialog uses version 7, even if you have 8 installed.
try creating a web dialog and set the url to: http://www.quirksmode.org/js/detect.html
you should see "You're using Explorer 7 on Windows!" or something similar.
-
@cjthompson said:
As far as I can see, the web dialog uses version 7, even if you have 8 installed.
try creating a web dialog and set the url to: http://www.quirksmode.org/js/detect.html
you should see "You're using Explorer 7 on Windows!" or something similar.
hm... I mean to remember that I had to set the IE7 compat tag to force my dialog to render as IE7.
Did you add the correct DOCTYPE to the HTML document? -
Ah, you set the dialog to use that URL.
hm.. that URL uses Transitional DOCYTPE, not sure if that trigger IE8 mode... -
Looking into it.
Transitional DOCYTYPE will trigger IE7 mode.
Strict DOCTYPE is required for IE8 Super Standard mode
No or malformed DOCTYPE triggers quicks mode. -
this is the user agent string I got from fiddler:
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
-
Hmm... Seems it needs to be enabled by Sketchup...
http://blogs.msdn.com/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspxsigh They made it so that it can't be enabled on a per instance or per page instance...
-
Doing some more testing.
I added this meta tag to a Strict document:
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
The user-agent string still reported IE7, but the new CSS feature
outline
worked. If I remove the meta tag theoutline
property doesn't render.And just to make sure, I used
document.documentMode
to get the render mode, with the meta tag it reports IE8, without IE7.So this is another nail in the coffin for the user-agent string <- mostly pointless and highly unreliable.
I attached the test code I used. Extract it to your plugins menu and type this into the Console to open up a webdialog:
dlg = UI;;WebDialog.new("Test") dlg.set_url Sketchup.find_support_file "test.html", "Plugins/" dlg.show
It will first report IE7 mode. But remove the comments around the META tag and see how the blue outline now renders and the JS reports IE8 mode.
You can also see the different behaviour from regular IE windows.
Advertisement