Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>it is possible on IE and firefox... but wonder how it will work on Safari and Crome searching the same...</p> <h2>for FF</h2> <pre><code>netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); // Open the save file dialog var nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); fp.init(window, "Save File...", nsIFilePicker.modeSave); //fp.appendFilters(nsIFilePicker.filterHTML); fp.appendFilter("HTML File","*.htm; *.html"); fp.defaultString="data.htm"; var rv = fp.show(); if (rv == fp.returnCancel) return; if(rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace){ // Open the file and write to it var file = fp.file; //var filePath = file.path+".htm"; // //file.initWithPath(filePath); if(file.exists() == false){//create as necessary file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 ); } var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance( Components.interfaces.nsIFileOutputStream ); outputStream.init( file, 0x04 | 0x08 | 0x20, 640, 0 ); var result = outputStream.write( output, output.length ); g.filename.value=file.path; outputStream.close(); alert('File has been saved.' ); } </code></pre> <hr> <h2>for IE</h2> <pre><code>var w = window.frames.w; if( !w ) { w = document.createElement( 'iframe' ); w.id = 'w'; w.style.display = 'none'; document.body.insertBefore( w ); w = window.frames.w; if( !w ) { w = window.open( '', '_temp', 'width=100,height=100' ); if( !w ) { window.alert( 'Sorry, could not create file.' ); return false; } } } var d = w.document; d.open( 'text/xml', 'replace'); d.charset = "UTF-8"; d.write(JWPFormToHTML(f)); d.close(); var name= g.filename.value; if( d.execCommand( 'SaveAs', false , name ) ) { g.filename.value=name; //document.getElementById("filename").value=""; alert('File has been saved.' ); } else { alert( 'The file has not been saved.\nIs there a problem?' ); } w.close(); return false; </code></pre> <hr> <p><strong>EDIT</strong></p> <p>got it on safari and chrome as well you have to create a signed applet to create read and write files and access the local data using the same :P</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload