JavaScript Behaviour RRS feed

  • Question

  • Hi there

    I am having a bit of difficulty using running JavaScript in certain instances of IE

    At My office all the users are using IE 11 including myself. I have written a web app (in MVC) that uses a lot of JavaScript. the app has been published to a communal server.

    In all cases I am browsing to the communally published version on the server
    When I test this app in IE from My Computer it works perfectly no problems what so ever.
    When I test on one of my colleagues computers it will only work if they have the f12 developer tools running.

    If any one can help, or offer any insight it would be great as i'm running out hair and im worried what next to pull out!!

    Many thanks


    Tuesday, July 14, 2015 3:41 PM


  • Hi,

    to debug your web pages from IE...

    f12>Debug tab, select the option "Break on all errors" from the dropdown on the debug tab, return to your web page without closing the Dev tool or selecting another tab (leave it on the debug tab).

    Refresh the page (f5).

    Normally without the Dev tool displayed and the debug tab selected scripting errors are suppressed from displaying error messages and warnings to the user. The above settings will break the debugger on any errors that are normally hidden from the user. (this applies to all current web browsers, webkit and gecko.... you need to have the dev tool opened and configured to display the error messages and warnings.)

    On your computer, you may like to adjust a setting that allows the dev tool to record errors and warnings when the dev tool is not opened...(there is a small overhead in performance, so this setting is best for developers only).
    Tools>Internet Options>Advanced tab, check "Always record developer console messages".

    When I test on one of my colleagues computers it will only work if they have the f12 developer tools running.

    This can occur if your page is using IE9 or lower emulation mode or you are using IE9 or lower and you have left debug code in your production scripts or on pages that are using canvas.getContext2d. Using the dev tools debug tab, enter "console." in the search box (top rhs of the debug tab) and find all occurrences of console. calls. Return to visual studio and locate the console calls in your scripts and comment them out. // this is a javascript commented line. It appears green in the VS IDE.

    IE10 and higher, already have the console object defined in their DOM's and so will not throw a suppressed error... Naturally, when you have the dev tool opened, the console object is present and defined in the DOM.

    All web browsers have security settings (and some AV products as well) that suppress execution of javascript and vbscript in web pages. Sometimes users will attempt to 'try to get the d**n thing to work by tweaking their IE security zone settings or placing a domain in the trusted or restricted sites zone of IE security zones.
    First ensure they are using the default IE Security zone settings.
    Tools>Internet Options>Security tab, click "Reset all zones to default".
    Normally only sites in the Restricted zone have a security zone setting to disable "Active Scripting" and "Scripting of ActiveX controls and applets" but sometime a user may try to adjust that setting for the Internet and Trusted zones in frustration.... use the "Reset all zones to default" button to quickly return the security zone settings to their factory defaults.

    Second, in your html markup or your mvc templates you can add a <noscript> tag (I suggest immediately after the opening body tag) that will only be visible if the userAgent has ActiveScripting disabled. eg.
    ...... doctype>Head>body>
    <noscript>Active scripting(javascript) is disabled. Check your browser and Anti-virus security settings.</noscript>

    Lastly, this forum is for questions about domain management and deployment of IE.
    Please post any further questions about website development (html, css and scripting) to the links to the stackoverflow forums provided in the following link.
    IE Web development forum is moving to stackoverflow

    If possible include with your questions a link to your website or a publicly accessible mashup that shows the issue you are facing.

    The IE Development documentation can be found here -.... actually they have changed the links.
    Select the Docs menu at the top of the following page to explore documentation for IE and Microsoft Edge.
    other essential resources and documentation can be found here - http://modern.ie



    Wednesday, July 15, 2015 12:24 AM