【问题标题】:Use Sencha Touch in Windows 8 metro app在 Windows 8 Metro 应用程序中使用 Sencha Touch
【发布时间】:2014-01-16 15:05:52
【问题描述】:

我想知道如何在 Windows 8 Metro 应用项目和 Windows JS 项目中使用 Sencha Touch Frame。

当我尝试将 sencha Touch 添加到 html 页面时,我收到异常

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.

如果没有办法使用 Sencha touch 框架,有没有办法将 Sencha ExtJS 添加到 windows 8 Metro 应用程序

因为我们还需要为所有主要智能手机平台提供支持。

欢迎提出建议。

【问题讨论】:

    标签: extjs windows-8 sencha-touch hybrid-mobile-app


    【解决方案1】:

    替换

    document.write(content);
    

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

    developement.jstesting.jsproduction.js 中,我们包含在我们的应用程序中就可以做到这一点。特别是我们需要在该函数中创建一个带有 document.write(content) 作为语句的 function(),然后将该函数作为参数传递给 MSApp.exeUnsafeLocalFunction() 就可以了。

    【讨论】:

    • 我遇到了同样的问题,在 development.js 中我用代码替换,在 index.html 中我也在添加“winstore-compat.js”补丁,但它不起作用。 ..任何线索?非常感谢
    • production.js 在 Touch 2.4.2 中没有 document.write()。到目前为止,使用上述答案进行开发。
    • 可能是脚本在生产中被缩小,文档可能会替换为我认为的一些字母,但我现在不确定。
    【解决方案2】:

    我相信您必须将一些微加载器代码包装在 execUnsafeLocalFunction 调用中,因为 Windows CSP 不喜欢 evaldocument.write 和其他一些核心 Sencha Touch 库中使用的位。

    【讨论】:

    • 我试过但没有工作。但不工作可能会错过一些东西。
    【解决方案3】:

    我相信您在静态页面中包含脚本并使用其中的函数,即使您使用简单的 javascript 方法也会显示错误。要解决此问题,请使用 Hub 控件。 这是集线器快速入门的 msdn 链接 http://msdn.microsoft.com/en-us/library/windows/apps/dn412707.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-14
      • 1970-01-01
      • 2013-01-05
      • 2013-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多