I'm developing an application for Windows Phone 8.
Basically the application is developed using jQuery/jquery Mobile, Javascript and HTML and I want to add content dynamically.
Whenever I try to do this an error occurs which is:
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.
I searched for it and found that you cannot add HTML content dynamically due to security reasons. I also found that we can forcefully do that within the function:
MSApp.execUnsafeLocalFunction(function () {});
But the problem is, in the whole application I've to add HTML content Dynamically. So there will be extra overhead for any small content adding to be written with the function.
The HTML content i want to add is for example:
var Html = '<div class="boxgrid2 cover" style="background-image: url(images/' + varimage + '), url(images/BoxTrade.png);" ><div id="qty1" class="AniQty1 allfont">' + quantity + '</div><div id="name1" class="AniName1 allfont">' + varaname + '</div><div id="rate1" class="AniRate1 allfont">' + buyrate1 + '</div></div>';
$("#tradeAnimalDiv").html(Html);
So basically the content contains div's and dynamic contents that are fetched from local database.
If there is any other solution or setting which can be used to allow permission for dynamically adding HTML content than please help me out.
Thanks & Regards