locked
Adding dynamic content to the DOM withtout execUnsafeLocalFunction

    Question

  • Hi there,

    Everyone here knows that it's an issue to add some types of dynamic HTML to the DOM. It needs to be static first or to be added by execUnsafeLocalFunction.

    Today I needed to integrate a 3rd party javascript that handles payments (Call it "JavaScript A". This 3rd party loads its own JavaScript files from the web (Call it "JavaScript B", "JavaScript C").

    "JavaScript A" tries to use innerHtml and update the DOM (to show the UI for the payments), so I wrapped the method with execUnsafeLocalFunction.

    Now, "JavaScript B" and "JavaScript C" which are loaded dynamically from the web (not shipped with my app) are trying to do the very same thing. (user innerHtml with restricted tags).

    Let's assume for a moment that I can't contact that payment service guys who wrote these javascripts (I really can't). How do I overcome this issue? I must use these Javascripts.

    Thank you!

    Lidan

    Wednesday, December 24, 2014 2:45 PM

Answers

  • Hi Lidan,

    Is it possible that we use WinJS.xhr() to get the latest version of Script B and Script C, save them to local as javascript library and link to them by your main HTML code?

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 26, 2014 2:20 AM
    Moderator