1

I am experiencing an annoying error that I only receive in Internet Explorer for some reason. I have an MVC application and in my _Layout.cshtml file I have @Scripts.Render("~/assets/js/bundled"). The bundled seems to be included fine and like I said everything works great in all tested browsers except IE11. When debugging with in IE I get:

0x800a1391 - JavaScript runtime error: 'MyJs' is undefined

The javascript file containing the definition for myjs is included in the bundle. The js (lets call it myjs.settings.js)file looks like this:

MyJs.settings = (function (parent, window, document, $) {

   function Initialize() { /* do stuff */ }
   function Something() { /* more stuff */ }

   var self = {
      Initialize: Initialize,
      Something: Something,
      Debug: debug
   }

   return self;

} (MyJs, window, document, jQuery));

MyJs.settings.Debug = false;
MyJs.settings.Initialize();

Any help would be greatly appreciated. Thanks.

4
  • 3
    is MyJs previously instantiated? What does window.MyJs show in the console? Sep 16, 2015 at 14:23
  • thanks for pointing out the obvious...I struggle with it for hours and it was something so simple...man I feel dumb...thanks!!
    – mgrenier
    Sep 16, 2015 at 15:00
  • still wonder why it worked in firefox and chrome though???
    – mgrenier
    Sep 16, 2015 at 15:01
  • Firefox and Chrome are more forgivers and usualy will create the instanse on the fly
    – kleinohad
    Mar 9, 2020 at 7:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.