Using AppendTo/jquery-win8 in Win8 apps

≡放荡痞女 提交于 2020-01-04 03:38:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!