I have some JS that runs fine in FF and IE but in Chrome I see the following error:
uncaught exception ReferenceError: JSON is not defined
I presume I need to include something but I'm not sure what. Help?
Also, any clue why this might work on IE/FF but not Chrome?
Btw, I'm using JSON.stringify() in my script.
UPDATE: JSON.stringify is now available in chrome (couldn't find when it was introduced).
The JSON object is not yet part of the standard IIRC, but is expected to be soon. In the meantime, browsers are free to implement it at will, and that's probably what you are seeing here.
Your best bet is to get a separate library that does the same thing and use it for the meantime until native implementations are more widespread. You can find a very good one here (Link at the bottom).
Related
I have a website which is live and I am using BOOMR to do something with my data. However. on Prod env for firefox browser, it is showing this below error on consoleUncaught TypeError:
BOOMR.hasSentPageLoadBeacon is not a function
But, it's working fine on chrome and other browsers. Also, for non prod envs all browsers are working fine.
This sounds as though the BOOMR object may not be loaded or at least is not loaded correctly or fully.
In the browser Console look to see what is returned when you type BOOMR and press enter. If the BOOMR object isn't there then you'll need to investigate what could be blocking it. Since this is browser and environment specific, I recommend looking for JS errors in the console fist.
Another possibility is that the BOOMR object is not loaded early enough and whatever code is calling the BOOMR.hasSentPageLoadBeacon is trying to execute the method before the object is loaded.
I'd also ensure that you are using the latest version of the BOOR library to make best use of its latest features and compatibility updates.
I have an Angular5 single-page app that works perfectly on Google Chrome, Firefox, Microsoft Edge and mobile browsers. However, with IE11, I get the errors:
ERROR TypeError: Object doesn't support property or method 'find'
and
ERROR TypeError: Object doesn't support property or method 'startswith'
Based on Angular docs, it's supposed to support IE11. I tried to apply fixes on the browser settings (as per Microsoft forums) like reset Advanced Settings in Internet Options and trying in compatibility mode, etc. But nothing on the browser configuration worked.
Is there any special configuration required on Angular side to make it work on IE11? How can I fix the errors mentioned above?
I'm not sure which code samples may be relevant, please let me know and I can provide. Thanks.
EDIT: More details on the accepted solution can be found in Angular - Browser Support. Specifically, enabling polyfills.
There should be a file called
polyfills.ts
In it, you can uncomment various polyfills for different browsers. Just read the commentblocks.
Those errors pop because IE doesn't implement those functions.
To resolve this, simply look for the functions on MDN's website.
For instance, here is the find method.
If you go to the bottom of the page, you will find a polyfill for this function (in the page I gave you, in french, it is Prothèse d'émulation).
Simply copy and paste your code into a Typescript file, and import that typescript file into your project.
My company recently launched a website and we're getting a JavaScript error often in IE11.
Object doesn't support property or method '[ext. func name]' [Internet Explorer 11.0]
In our code we're frequently extending jQuery with the following syntax:
$.fn.center=function() { ...... };
The error message always happens on those functions. Is there a solution to this? Or at least an explanation? I'm ok with changing the code but I'd like to understand why it is happening as well.
I have not been able to reproduce this issue in IE11 myself. The only reason we're able to see the errors is because we're AJAX'ing all clientside errors to ourselves via window.onerror.
I am not sure about jQuery, but if you use compilation for your project, you might consider to add at the top of your entry point
import 'core-js'
At the moment core-js polyfill library is the easiest way to make Cross Browser Support
So, I have a large project with a bunch of javascript stuff going on.
Now I did some testing with IE9 and on one event triggered AJAX-operation it aborts and tells me
Syntax Error: Expected ')'
but that's all it says. It leaves me without any clue about where to start looking.
I'm using Dojo for most of the things I do and at this particular point I'm retrieving JSON-data with the AJAX-request. But I've ruled out an error in the JSON-string, simply because JSON ususally does not contain brackets (), right?
There also is a console.log(data) right after the request should be completed, but it doesn't fire either. And I don't see any fancy bracketwork before that, that could make IE lose it's mind. But I might still be looking at the wrong spot, just trying to give as much info as possible here.
(btw: Firefox is fine with everything. No errors or warnings; everything runs just fine)
What's the best way to debug this or possible causes?
Versions of Internet Explorer from 8 upwards have a built in debugger which is similar to Firebug - press F12 to launch it (by default).
The standard error reporting is terrible, but the debugger will give you much more accurate feedback on where the error occurred.
(My take on this is that the standard Javascript error handling assumes you're a typical IE user and gives you very little feedback. Firing up the dev tools lets it know you can handle the truth.)
It was the response from AJAX after all.
IE had problems sending all the GET parameters resulting in an error message being mixed with the JSON code. I still don't understand why it expected a ) but fixing the response fixed the issue.
I have a big (probably) javascript problem.
i have a long and complex script on the page based on mootools framework,
in FF and other browser everything works fine, but in ie 6 and 7 i got "error:153 (sometimes 84) Unspecified error" and the strange thing is in IE8 that show me the error "Object doesn't support this property or method".
someone know the possible cause of the problem? o maybe someone know a list of IE's unsupported property or method?
In IE8 you can get the line number of the error, then right-click -> view source. IE8 has a proper source, which includes script lines, so you should quickly be able to find the source of your error.
If the script you're using isn't obfuscated or all on one line, you could use the JavaScript debugger in IE8 to pinpoint the object which is causing the error. Press F12 to open the Developer Tools, go to the Script tab, and click the "Start Debugging" option. If there's an error it may well break on the relevant line. If not you can set some breakpoints and step through the code.
You can also use IE8 developer tools http://blogs.msdn.com/ie/archive/2008/09/03/developer-tools-in-internet-explorer-8-beta-2.aspx to debug.
For other version I suggest you use Web developer tool bar which is similar to web developer tool bar for firefox.
Its near impossible to tell what the problem is with this information (at least for me).
For IE6/7 I suggest adding a few alerts to the javascript in intervals to find out exactly what line of code is causing your problem. If you know which object is causing the error, it is usually quite simple to find out what the exact problem is.
IE8 provides nice debugging tools, so that is a good place to start.
In my case the error was due to a $ mapping conflict.
Using jQuery instead of $ solved the issue.