locked
JQuery Compatibility With Metro

    Question

  • Hi,

    I installed JQuery 1.9 with Nuget but it seem the out of the box script is not compatible with windows metro as it thinks it is doing a script injection and anytime I run the app I get this error:


    Unhandled exception at line 1444, column 3 in ms-appx://c084e487-45fa-46f2-a386-b7d7a45cf3a0/scripts/jquery-1.9.0.js

    0x800c001c - JavaScript runtime error: Unable to add dynamic content. A script attempted to inject dynamic content or elements previously modified dynamically that might be unsafe. For example, using the innerHTML property to add script or malformed HTML will generate this exception. Use the toStaticHTML method to filter dynamic content or explicitly create elements and attributes with a method such as createElement. For more information, see http://go.microsoft.com/fwlink/?LinkID=247104.


    I did some searching on StackOverflow and saw people discussing various different ways to get it to work but I wonder what the proper way to do this is.


    Can anyone link me to or post instructions for proper way to change JQuery to work with a Windows 8 Metro App.


    Thankyou


    Friday, January 18, 2013 9:54 PM

All replies

  • Tech Guy,

    appendTo plans to start looking at the 1.9 release of jQuery next week and start making it Win8 friendly.

    There are several things that jQuery does that Win8 does not like (as you listed above). 

    As we did with 1.8 we made sure any errors at load time and runtime were removed. In addition we provided a flag to tell Win8 to not complain if we, as a developer, know what we are doing. 

    As we make these changes we run the existing jQuery Unit Test suite (6000+ tests) to make sure we didn't break anything accidentally.

    Keep watch at http://twitter.com/appendTo and http://appendto.com for additional news

    ---

    Elijah Manor - Microsoft RD, Microsoft MVP, ASPInsider

    http://twitter.com/elijahmanor


    Friday, January 18, 2013 11:15 PM
  • Thanks.

    I manually installed 1.8.2 from appendto and used the VSDoc which works great (although seems to give slightly less information on intellisense than nuget but not sure if that's my imagination).

     

    If I had installed older version through Nuget would it have worked out of the box?

    Friday, January 18, 2013 11:35 PM