Careful with Microsoft.Dynamics.NAV JavaScript object

Make sure that you don’t access the Microsoft.Dynamics.NAV JavaScript object before the document ready event fires. If you do so, you might experience problems on Chrome when the user refreshes the browser (F5). It appears that on refresh Chrome loads (and runs) scripts in different order, and depending on how complex scripts included in your project are, your code might get executed before Microsoft’s script is loaded, and it will cause nasty script errors. This occurs only on Chrome on PC.

Vjeko

Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.

This Post Has 3 Comments

  1. louagej

    Hey Vjeko,
    On the Tech Days in Antwerp, you showed an example with an ObjectEventhandler in the IControlAddIn.cs.
    When I’m trying to build this, I get an error saying:
    The type or namespace name ‘ObjectEventhandler’ could not be found (are you missing a using directive or an assembly reference?)
    Is the ObjectEventhandler an C# assembly or some library we can find on the internet?
    Kind regards,
    Job

    1. Vjeko

      You simply need to declare, somewhere in your namespace, public delegate void ObjectEventHandler(object data);

Leave a Reply to louagej Cancel reply