jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery-mobile – Windows 8 Phonegap应用程序JQuery Mobile Security Exception大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用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()方法.

但请注意,我还没有尝试过任何这些方法,所以不能保证它们的有效性.

大佬总结

以上是大佬教程为你收集整理的jquery-mobile – Windows 8 Phonegap应用程序JQuery Mobile Security Exception全部内容,希望文章能够帮你解决jquery-mobile – Windows 8 Phonegap应用程序JQuery Mobile Security Exception所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。