我使用phonegap 2.9.0 创建了一个Windows 8 项目,然后尝试在其中使用JQuery 移动库。但我收到以下安全异常。知道如何解决这个问题吗?
Exception was thrown at line 4, column 7009 in ms-appx://c6a291ce-903f-47ab-b167- cb8378ffb051/www/libs/jquery.core/jquery-1.9.1.min.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.
If there is a handler for this exception, the program may be safely continued.
我刚刚遇到了同样的问题。看来问题的关键在于,当您从字符串创建元素时,WinJS 安全模型将不允许 JQuery dom 操作。使用 .html() 方法。
请参阅以下内容了解更多信息:http://blogs.msdn.com/b/windowsappdev/archive/2013/04/01/windows-store-app-support-in-jquery-version-2-0.aspx
http://net.tutsplus.com/tutorials/javascript-ajax/building-windows-store-applications-with-jquery-2-0/
总之,聪明的人们在 JQuery 2.0 中对此进行了修复。
因此,我将考虑使用 JQuery 2.0,但它可以与 JQuery Mobile 一起使用吗?我还没有确定这一点,所以我可能会考虑完全构建和附加 dom 元素,而不是使用 .html() 方法。
但请注意,我尚未尝试过任何这些方法,因此无法保证它们的有效性。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)