javascript - How to load HTML into iframe in a Chrome packaged app -


i trying make chrome packaged app allow file save disk. planning open file using chrome.filesystem.chooseentry(). have load iframe sandbox attribute set. use document event listenders (document.createevent) wait client file send updated file content, , save file system.

so there 2 things need do, , first 1 have been able find little information on inside chrome packaged app, can't use document.write. can't use body.innerhtml because full html document head element.

  1. i want load file iframe run it. file may several mbs. can data url handle big? put in in src? or put somewhere else , set src javascript:void(0);?
  2. i want inject element iframe dom , listen events on element. looks might able copy on implementation firefox have.

here's code have open it, copied chrome.filesystem page.

chrome.filesystem.chooseentry(     {         type: 'openfile',          accepts:[{             extensions: ['html']         }]      },      function(fileentry) {         if (!fileentry) {             return;         }         console.log(fileentry);         fileentry.file(function(file) {             console.log(file);             var reader = new filereader();             reader.onload = function(e) {                 console.log(e);                  //set iframe contentdocument             };             reader.readastext(file);         });     } ); 

this iframe.

<iframe id="test" sandbox="allow-scripts allow-popups allow-forms allow-same-origin" seamless="seamless"></iframe> 

i ended using webview. , it, because acts totally normal browser window, except context menu. behind scenes stuff seems normal, except alert, prompt, , confirm, have implement in parent window, , fact have use events allow access external, except maybe ajax requests.


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -