ScriptErrors opening (a new tab of) IE10 on a Windows 7 machine

An error has occured in the script on this page. Unable to get property 'style' of undefined or null reference.I’ve been running into the error message on the right (“Unable to get property ‘style’ of undefined or null reference”) when opening an instance or a new tab of IE10 for the past couple of weeks. It didn’t matter what start page I used, since I tried about:blank, and approximately a dozen more. I found out McAfee SiteAdvisor was the cause of this error pretty quick, but since the company I’m currently in doesn’t allow users to disable SiteAdvisor and I needed IE10 for some testing purposes, I had to find a different solution to the problem.

I found a workaround which will do for now: in IE10, go to ‘Tools’ then ‘Compatibility View Settings’ and check ‘Display all websites in Compatibility View’. This will, as you imagined, open all pages in Compatibility View which causes the errors to stop popping up. It is not an ideal solution, but it’s better than closing a script error message for every single IE instance or tab that is opened. Besides, it’s pretty easy to get IE to render as true IE10 in stead of Compatibility View by changing the browser mode to IE10 in the F12 developer tools.

Good to know: after changing browser mode to normal IE10 in a tab, the error doesn’t occur in that tab for the current or subsequent pages you visit while it maintains the Browser Mode. Of course new instances and new tabs will have Compatibility View enabled again.

Hope this helps

Solution for the scripterror caused by McAfee SiteAdvisor in IE10.

Debugging JavaScript with Visual Studio in an ASP.NET MVC 4 application

When debugging JavaScript in an ASP.NET MVC (4) application, it is not always enough to uncheck the ‘Disable script debugging’ checkboxes under ‘Tools’ – ‘Internet Options’ – ‘Advanced’ – ‘Browsing’. JavaScript inside a Razor view (a cshtml file) cannot be debugged from Visual Studio. To debug your JavaScript, move it to a separate .js file and link to that file from your Razor view. This way, breakpoints set in the JavaScript will be hit and you can debug from Visual Studio.

Hope this helps


Disclaimer: I know about the F12 Developer Tools, Firebug and all the other possibilities we have to debug JavaScript. This post is about getting JavaScript debugging to work with Visual Studio and breakpoints set in Visual Studio. For those who want it that way. So there… ;)