sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Built-in JSON in Internet Explorer 8 IE8

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 1.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jim
      last edited by

      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.

      Hi

      1 Reply Last reply Reply Quote 0
      • C Offline
        cjthompson
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @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?

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Ah, you set the dialog to use that URL.
            hm.. that URL uses Transitional DOCYTPE, not sure if that trigger IE8 mode...

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              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.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • C Offline
                cjthompson
                last edited by

                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)"

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Hmm... Seems it needs to be enabled by Sketchup...
                  http://blogs.msdn.com/ie/archive/2009/03/10/more-ie8-extensibility-improvements.aspx

                  sigh They made it so that it can't be enabled on a per instance or per page instance...

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    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 the outline 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.


                    test.zip

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement