Dynamic java script zoom error in vb.net project - javascript

I inherited a legacy VB.net project that always has the following error:
document.body.style.zoom = screen.logicalXDPI / screen.deviceXDPI;
The exact error message from VIsual Studio is as follows:
JavaScript runtime error: Unable to get property 'style' of undefined or null reference
I have searched the entire solution, but none of the relevant variables/attributes show up.
I assume this is a javascript or jquery problem, the debugger says that it is a script block [dynamic] and the Call Stack says that it is global code.
Has anyone seen this error before?
Please help. Thanks in advance.

Believe it or not, removing add-ins in the browser did the trick (thanks to a colleague). It's not in the code-base at all in this case. The specific culprit was a MacAfee add-in. I never would have guessed this.

Related

Cannot read property 'querySelector' of null - WordPress / Contact Form 7

Seem to be getting an error on our contact forms on version 5.4.1 and the version before using the Contact Form 7 plugin on WordPress. The error occurs when submitting the form regardless of entering information or not. The error which appears in console is as follows:
TypeError: Cannot read property 'querySelector' of null
at c (index.js?ver=5.4.1:1)
at Array.forEach (<anonymous>)
at index.js?ver=5.4.1:1
Read a couple of articles about rolling back to version 5.3.2 which I can confirm works and the issue isn't present in this version. Does anyone have a fix for it though? Or do we need to wait for another update? It's been a couple of weeks now since this was first found I believe.
If anyone needs any other information please let me know and I'll try to supply it.
Thanks!
You can edit
define( ‘WPCF7_LOAD_JS’, true );
to
define( ‘WPCF7_LOAD_JS’, false );
on wp-contact-form-7.php file.
This is due to a incompatability between your theme or a plugin with the new version of jquery used in wordpress. There are a few things you can do.
Update your theme and plugins and hope the JavaScript is patched by the author
Try to patch the broken code your self (this requires knowledge of javascript)
Install jQueryMigrate Plugin (this is only a Band-Aid and should not be the permanent solution)

Recurly js v3 Uncaught TypeError: Cannot read property 'config' of undefined

I am new to Recurly, I have setup a simple implementation to build on here http://unzipped.wpengine.com/recurly-integrate/ (you can see everything, it is html and a js file called recurly-integration.js which is added straight after the main recurly.js file.
I get this error:
Uncaught TypeError: Cannot read property 'config' of undefined from recurly.js - seems to be coming from the Pricing.reset function ???
Any help gratefully received as I have been trying to fix it for ages. Thanks.
For anyone else who might be having the same problem the solution was this:
in my recurly-integration.js I was doing like so:
var pricing = new recurly.Pricing();
Changing it to:
var pricing = recurly.Pricing();
Solved the problem.
Always feel free to contact support.recurly.com, we're pretty helpful and fast - I hate to hear that you've been debugging for ages without our help!
Running the browser error console, I'm seeing quite a few errors. As a test it would be best to run the
Recurly.js bare minimum (no pun intended- https://docs.recurly.com/js/#examples) and see if the error(s) re-occur. Then gradually add other elements and keep testing by monitoring the browser errors.
Hope you get this resolved soon!

JSCOMPILER_PRESERVE after compiling javascript with KJSCompiler

After compiling my JavaScript source with KJSCompiler (https://github.com/knyga/kjscompiler) I get this weird function wrapped around my code. If I try to include it in my live source code I get this error in the console "Uncaught ReferenceError: JSCOMPILER_PRESERVE is not defined ".
I thought that this problem occurred because I didn't add the "wrapper" in the JSON file of kjscompiler. After trying that it still occurs.
Does anyone have an idea how to fix this?
I came across this when using Closure Compiler directly via the Java API.
It seems to be caused by running the compiler in checks-only mode but with protect hidden side effects enabled. The late pass to remove protection of hidden side effects is skipped in checks-only mode.
I'm not sure about KJSCompiler specifically, but it might help to look at changing the compilation level to SIMPLE or ADVANCED, and/or how you might be able to control what checks and optimisations run to KJSCompiler, e.g. turning off CompilerOptions.protectHiddenSideEffects.
See https://github.com/google/closure-compiler/issues/1875
In addition to Steve S's answer:
set protectHiddenSideEffects after setting optimization level, as options.setProtectHiddenSideEffects(false); didn't work for me for GCC version v20180204 if I set it before setting CompilationLevel.
CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(compilerOptions);
//To remove JSCOMPILER_PRESERVE error: https://github.com/google/closure-compiler/issues/1875
compilerOptions.setProtectHiddenSideEffects(false);

Uncaught ReferenceError: chrome_fix3 is not defined _cmp_execLogic._cmp_suclick

I am getting the following error. How can I resolve this?
Uncaught ReferenceError: chrome_fix3 is not defined
_cmp_execLogic._cmp_suclick
Good news - the error is nothing to do with your site.
Bad news - it's caused by an erroneous browser extension that's injecting invalid javascript into your pages. I have an ever increasing list of similarly caused errors that we can do nothing other than trap and ignore. At some point I intend to feed a message back to the user that something they have installed may cause problems on our sites, but ideally I'd like to tell them exactly what extension is causing the issue, which I don't know in all cases.
If anyone knows where the attempt to reference "chrome_fix3" actually comes from, please add to this post.
A similar error that we trap but is nothing to do with our code is:
Uncaught ReferenceError: conduitPage is not defined
I found the following pages helpful when investigating the error:
https://webmademovies.lighthouseapp.com/projects/65733/tickets/2895-crash-referenceerror-conduitpage-is-not-defined
http://www.youtube.com/user/conduityoursite#g/c/4B820DE13E03888D
Your code tries to refer to a variable or property that does not exist, in your case it's named chrome_fix3.
This probably came from a javascript libary that you are using, maybe jQuery or something.
I assume that the library is fine and it's caused by wrongfully calling some of it's functions.
The best way now is to install the Firebug plugin in Firefox (you could use Chrome, Opera or Internet Explorer's debugger but I like Firebug best)
Then add following code in your code where you think it's going wrong:
//add the following line only once:
var okCounter=0;
// add teh following line every couple of lines in your code:
console.log("still ok here:",okCounter++);
Open your page in Forefox and hit F12, the Firebug window should show up now. Reload the page and check out the console tab.
At some point you should notice there is no more output to the console where there should be; now you have found the part in your code where something goes wrong. If you post that part we might be able to help you out more.

Uncaught TypeError: Cannot read property '1' of undefined

trying to fiddle with an app, getting this error "Uncaught TypeError: Cannot read property '1' of undefined "in dev tools console. i'm pretty sure it's because of the json i'm pulling and the proxy i'm using are not talking to each other correctly. seriously n00b question, i truly don't understand what's going on in the document. i also see that there are ALOT of similar questions like this, so i'm guessing they're pretty localized and not great for the community. still important to me though...i'd like to learn what's going on in the code, not just fix the problem. you can check it out here: http://dev.bowdenweb.com/busfinder.html i did put it up on jsfiddle, but it wasn't rendering correctly. thanks for any and all advice!
loadBusesIntoMap seems to be the root of the problem. On Chrome developer tools, click on the arrow next to the error and track the stack. Just before running Google maps code the function that throws error is that one. It's very probable that somewhere you're sending an empty buses array. I'd start by checking if it's empty or has a length first...

Categories

Resources