问题
I am tempting to look at the ToDoMVC samples and have tried porting them to a Win8 JS app by just copying and pasting the code but also having the relevant WinJS libs referenced.
Due to MS security principals around InnerHTML etc I have referenced jQuery-Win8 which attempts to get around the issue however in the Angular and Backbone examples when I run the app I get an exception on appendChild
I've read in some places you should be able to continue running the app but if I do press Continue on the exception the app shuts down anyway.
Can anyone point me in the right direction to get this running?
Thanks
UPDATE: Here's a screenshot of the exception in VS
回答1:
appendTo's version removes errors that occur when running jQuery at load time. You still may have code that violates the security model Microsoft put in place. Microsoft is trying to make you aware that there is a risk adding un-sanitized markup to your page.
If you are confident that is not the case you can try setting jQuery.isUnsafe
to true
after the appendTo library is included. That should wrap all possible unsafe calls with MSApp.execUnsafeLocalFunction
so that Microsoft doesn't complain.
Note: This flag is turned off by default
来源:https://stackoverflow.com/questions/14457232/using-appendto-jquery-win8-in-win8-apps