Use Sencha Touch in Windows 8 metro app

坚强是说给别人听的谎言 提交于 2019-12-11 01:09:48

问题


I want to know how to use Sencha Touch Frame in windows 8 metro app project with Windows JS project.

When i try to add sencha Touch to html page i receive exception

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 no way to use Sencha touch framework is there any way to add Sencha ExtJS to windows 8 metro app.

Because we need to provide support all major Smart Phone platform also.

Suggestions are welcome.


回答1:


replace

document.write(content);

with

MSApp.execUnsafeLocalFunction(function () {
       document.write(content);
    });

in developement.js or testing.js or production.js which we included in our application will did that trick. Particulary we need create a function() with document.write(content) as statement inside that function then pass that function as argument for MSApp.exeUnsafeLocalFunction() will do that trick.




回答2:


I believe you have to wrap some of the microloader code in an execUnsafeLocalFunction call because the Windows CSP doesn't like eval, document.write and some other bits used in the core Sencha Touch library.




回答3:


I believe you are including the script and using the functions from it in the static pages, the error will show up even if you use simple javascript methods. To solve this use a Hub control. Here is the msdn link for hub quickstart http://msdn.microsoft.com/en-us/library/windows/apps/dn412707.aspx



来源:https://stackoverflow.com/questions/21165397/use-sencha-touch-in-windows-8-metro-app

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