I have created a windows 8 project using the phonegap 2.9.0 and then tried to use JQuery mobile library within it. But I get the following security exception. Any idea how to resolve this ?.
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.
I have just run into the same problem. It appears that the grist of the matter is that the WinJS security model won't allow the JQuery dom manipulation when you create elements from strings e.g. using the .html() method.
See the below for more information: 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/
In summary the clever people have produced a fix to this in JQuery 2.0.
So I'll be looking at using JQuery 2.0 but will it work with JQuery Mobile? I haven't determined that yet so I'll probably look at fully building and attaching the dom elements rather than using the .html() method.
But please note that I have not tried any of these approaches yet so cannot vouch for their validity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With