2

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.

CoolMonster
  • 2,258
  • 25
  • 50

3 Answers3

5

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.

CoolMonster
  • 2,258
  • 25
  • 50
  • I am having the same problem, in the development.js I am replacing with the code and in the index.html also I am adding "winstore-compat.js" patch but it is not working... any clue?? thank you very much – inane Feb 22 '16 at 10:39
  • production.js does not have document.write() in Touch 2.4.2. Development works so far using the answer above. – osxdirk Apr 06 '16 at 18:01
  • May be script was minified in production and document may replace with some alphabet I think, But I am not sure about this now. – CoolMonster Apr 07 '16 at 06:41
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.

arthurakay
  • 5,631
  • 8
  • 37
  • 62
0

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

Ujjaval
  • 125
  • 1
  • 6