Loading ...
Sorry, an error occurred while loading the content.

Compatibility with IE

Expand Messages
  • cresimaind
    Hy with: taffy version = 2.6.1 And IE9: SCRIPT5009: JSON is undefined taffy.js, line 1384 character 15 With this imple test:
    Message 1 of 6 , Jul 23, 2012
    • 0 Attachment
      Hy
      with: taffy version = '2.6.1'
      And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15

      With this imple test:
      <html>
      <script type='text/javascript' src="js/taffy.js"></script>
      <head>
      <script>
      var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
      cities.insert({name:"Portland",state:"OR"});
      alert(cities({name:"Boston"}).count());
      </script>
      </head>
      <body></body>
      </html>

      Can you Help me?
      This code must be run in IE7/8/9 :-(
    • Dale Hurtt
      A search on Stackoverflow revealed this: http://stackoverflow.com/questions/5093582/json-is-undefined-error-in-ie-only The problem is not your code, but IEs
      Message 2 of 6 , Jul 24, 2012
      • 0 Attachment
        A search on Stackoverflow revealed this:

        http://stackoverflow.com/questions/5093582/json-is-undefined-error-in-ie-only

        The problem is not your code, but IEs implementation of JSON, apparently. See also the requirements section of:

        http://msdn.microsoft.com/en-us/library/cc836459(v=vs.94).aspx

        --- In taffydb@yahoogroups.com, "cresimaind" <cresimaind@...> wrote:
        >
        > Hy
        > with: taffy version = '2.6.1'
        > And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15
        >
        > With this imple test:
        > <html>
        > <script type='text/javascript' src="js/taffy.js"></script>
        > <head>
        > <script>
        > var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
        > cities.insert({name:"Portland",state:"OR"});
        > alert(cities({name:"Boston"}).count());
        > </script>
        > </head>
        > <body></body>
        > </html>
        >
        > Can you Help me?
        > This code must be run in IE7/8/9 :-(
        >
      • Dale Hurtt
        More specifically, you want to set the doctype in IE. http://msdn.microsoft.com/en-us/library/cc288325.aspx
        Message 3 of 6 , Jul 24, 2012
        • 0 Attachment
          More specifically, you want to set the doctype in IE.

          http://msdn.microsoft.com/en-us/library/cc288325.aspx

          --- In taffydb@yahoogroups.com, "cresimaind" <cresimaind@...> wrote:
          >
          > Hy
          > with: taffy version = '2.6.1'
          > And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15
          >
          > With this imple test:
          > <html>
          > <script type='text/javascript' src="js/taffy.js"></script>
          > <head>
          > <script>
          > var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
          > cities.insert({name:"Portland",state:"OR"});
          > alert(cities({name:"Boston"}).count());
          > </script>
          > </head>
          > <body></body>
          > </html>
          >
          > Can you Help me?
          > This code must be run in IE7/8/9 :-(
          >
        • Michael Mikowski
          This is probably my fault. I ripped out the emulated the native JSON object and submitted it to the maintainer, because almost all modern browsers support
          Message 4 of 6 , Jul 24, 2012
          • 0 Attachment
            This is probably my fault.

            I ripped out the emulated the native JSON object and submitted it to the maintainer, because almost all modern browsers support native JSON object.   A large portion of the code was devoted to the JSON parser, and it is redundant with the JSON parser found in jQuery.   I think Ian submitted this mostly as-is, so the extraction stood.

            IE8 is supposed to (see http://www.w3schools.com/json/json_eval.asp, list of supported browsers).  I have confirmed the Taffy internals use the standard JSON object interface, so I am not sure why this should fail in IE9 though.  Probably something to do with quirks mode (ah, the brilliance of quirks mode!).

            The solution that might work best:  Check for JSON object capability, and if not, through a helpful "this is how you add an emulated JSON object to your code so we can support this shitty browser" message.  Or something to that effect :)  So here is a fix for JSON emulation.  I'm sure there are better approaches:

            1. Load the jQuery JSON plugin (http://code.google.com/p/jquery-json/) prior to your code
            2. Add this code to emulate JSON right at line 45:

            if ( ! window.JSON ){
              if ( ! $.toJSON ){
                throw 'This environment does not support the native JSON object.'
                  + 'Please install the jQuery JSON plugin and we will use that.'
                  ;
              }
              window.JSON = {};
              window.JSON.stringfy = $.toJSON;
              window.JSON.parse    = $.secureEvalJSON;
            }

            As for support to IE7, I think TaffyDB should support it (after a JSON fix), but you have my sympathy ;)

            Ian, look a pull request for this fix.


            Cheers, Mike





            From: cresimaind <cresimaind@...>
            To: taffydb@yahoogroups.com
            Sent: Monday, July 23, 2012 7:07 AM
            Subject: [taffydb] Compatibility with IE

             
            Hy
            with: taffy version = '2.6.1'
            And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15

            With this imple test:
            <html>
            <script type='text/javascript' src="js/taffy.js"></script>
            <head>
            <script>
            var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
            cities.insert({name:"Portland",state:"OR"});
            alert(cities({name:"Boston"}).count());
            </script>
            </head>
            <body></body>
            </html>

            Can you Help me?
            This code must be run in IE7/8/9 :-(



          • Marty
            Mike, Can you post the exact links for your fix? I have not been able to get IE from giving the JSON is Undefined error, even using a doctype
            Message 5 of 6 , Nov 29, 2012
            • 0 Attachment
              Mike,
              Can you post the exact <head..</head> links for your fix? I have not been able to get IE from giving the "JSON is Undefined" error, even using a doctype html to turn off quirks mode.
              My application is:
              http://application.gobencars.com/search4_t.php?d=86,66&type=0
              It will be identified by a single alert msg.

              Thanks
              Marty

              --- In taffydb@yahoogroups.com, Michael Mikowski <z_mikowski@...> wrote:
              >
              > This is probably my fault.
              >
              > I ripped out the emulated the native JSON object and submitted it to the maintainer, because almost all modern browsers support native JSON object.   A large portion of the code was devoted to the JSON parser, and it is redundant with the JSON parser found in jQuery.   I think Ian submitted this mostly as-is, so the extraction stood.
              >
              > IE8 is supposed to (see http://www.w3schools.com/json/json_eval.asp, list of supported browsers).  I have confirmed the Taffy internals use the standard JSON object interface, so I am not sure why this should fail in IE9 though.  Probably something to do with quirks mode (ah, the brilliance of quirks mode!).
              >
              >
              > The solution that might work best:  Check for JSON object capability, and if not, through a helpful "this is how you add an emulated JSON object to your code so we can support this shitty browser" message.  Or something to that effect :)  So here is afix for JSON emulation.  I'm sure there are better approaches:
              >
              > 1. Load the jQuery JSON plugin (http://code.google.com/p/jquery-json/) prior to your code
              >
              > 2. Add this code to emulate JSON right at line 45:
              >
              >
              > if ( ! window.JSON ){
              >   if ( ! $.toJSON ){
              >     throw 'This environment does not support the native JSON object.'
              >       + 'Please install the jQuery JSON plugin and we will use that.'
              >       ;
              >   }
              >   window.JSON = {};
              >   window.JSON.stringfy = $.toJSON;
              >   window.JSON.parse    = $.secureEvalJSON;
              > }
              >
              > As for support to IE7, I think TaffyDB should support it (after a JSON fix), but you have my sympathy ;)
              >
              > Ian, look a pull request for this fix.
              >
              >
              >
              > Cheers, Mike
              >
              >
              >
              >
              >
              > ________________________________
              > From: cresimaind <cresimaind@...>
              > To: taffydb@yahoogroups.com
              > Sent: Monday, July 23, 2012 7:07 AM
              > Subject: [taffydb] Compatibility with IE
              >
              >
              >  
              > Hy
              > with: taffy version = '2.6.1'
              > And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15
              >
              > With this imple test:
              > <html>
              > <script type='text/javascript' src="js/taffy.js"></script>
              > <head>
              > <script>
              > var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
              > cities.insert({name:"Portland",state:"OR"});
              > alert(cities({name:"Boston"}).count());
              > </script>
              > </head>
              > <body></body>
              > </html>
              >
              > Can you Help me?
              > This code must be run in IE7/8/9 :-(
              >
            • Marty
              Found solution:
              Message 6 of 6 , Dec 6, 2012
              • 0 Attachment
                Found solution:
                <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
                <script src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
                Marty

                --- In taffydb@yahoogroups.com, "Marty" <marty@...> wrote:
                >
                > Mike,
                > Can you post the exact <head..</head> links for your fix? I have not been able to get IE from giving the "JSON is Undefined" error, even using a doctype html to turn off quirks mode.
                > My application is:
                > http://application.gobencars.com/search4_t.php?d=86,66&type=0
                > It will be identified by a single alert msg.
                >
                > Thanks
                > Marty
                >
                > --- In taffydb@yahoogroups.com, Michael Mikowski <z_mikowski@> wrote:
                > >
                > > This is probably my fault.
                > >
                > > I ripped out the emulated the native JSON object and submitted it to the maintainer, because almost all modern browsers support native JSON object.   A large portion of the code was devoted to the JSON parser, and it is redundant with the JSON parser found in jQuery.   I think Ian submitted this mostly as-is, so the extraction stood.
                > >
                > > IE8 is supposed to (see http://www.w3schools.com/json/json_eval.asp, list of supported browsers).  I have confirmed the Taffy internals use the standard JSON object interface, so I am not sure why this should fail in IE9 though.  Probably something to do with quirks mode (ah, the brilliance of quirks mode!).
                > >
                > >
                > > The solution that might work best:  Check for JSON object capability, and if not, through a helpful "this is how you add an emulated JSON object to your code so we can support this shitty browser" message.  Or something to that effect :)  So here is afix for JSON emulation.  I'm sure there are better approaches:
                > >
                > > 1. Load the jQuery JSON plugin (http://code.google.com/p/jquery-json/) prior to your code
                > >
                > > 2. Add this code to emulate JSON right at line 45:
                > >
                > >
                > > if ( ! window.JSON ){
                > >   if ( ! $.toJSON ){
                > >     throw 'This environment does not support the native JSON object.'
                > >       + 'Please install the jQuery JSON plugin and we will use that.'
                > >       ;
                > >   }
                > >   window.JSON = {};
                > >   window.JSON.stringfy = $.toJSON;
                > >   window.JSON.parse    = $.secureEvalJSON;
                > > }
                > >
                > > As for support to IE7, I think TaffyDB should support it (after a JSON fix), but you have my sympathy ;)
                > >
                > > Ian, look a pull request for this fix.
                > >
                > >
                > >
                > > Cheers, Mike
                > >
                > >
                > >
                > >
                > >
                > > ________________________________
                > > From: cresimaind <cresimaind@>
                > > To: taffydb@yahoogroups.com
                > > Sent: Monday, July 23, 2012 7:07 AM
                > > Subject: [taffydb] Compatibility with IE
                > >
                > >
                > >  
                > > Hy
                > > with: taffy version = '2.6.1'
                > > And IE9: SCRIPT5009: 'JSON' is undefined taffy.js, line 1384 character 15
                > >
                > > With this imple test:
                > > <html>
                > > <script type='text/javascript' src="js/taffy.js"></script>
                > > <head>
                > > <script>
                > > var cities = TAFFY([{name:"New York",state:"WA"},{name:"Las Vegas",state:"NV"},{name:"Boston",state:"MA"}]);
                > > cities.insert({name:"Portland",state:"OR"});
                > > alert(cities({name:"Boston"}).count());
                > > </script>
                > > </head>
                > > <body></body>
                > > </html>
                > >
                > > Can you Help me?
                > > This code must be run in IE7/8/9 :-(
                > >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.