0 Comments

Microsoft’s MSApp.execUnsafeLocalFunction can be used to dynamically add potentially unsafe code to the DOM. If you want to use this function in a cross platform HTML 5 app, you might want to wrap the function like:

if ("undefined" === typeof Utilities)
{
    Utilities = {};
}

Utilities.executeUnsafe = function (func)
{
    if ("undefined" !== typeof MSApp)
    {
        MSApp.execUnsafeLocalFunction(function ()
        {
            func();
        });
    }
    else
    {
        func();
    }
};

Now you can call a potentially unsafe function, like:

Utilities.executeUnsafe(App.myFunction);

Where App.myFunction should be replaced by your function.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts