I have a CKEditor at my page, in order to allow users to edit html online.
one of the features I want to add to the page is the ability to save the contents of the editor with a button like “Save Template”, which will be followed by the save/open window, without security warnings or page refresh.
I realize that Javascript can’t access the client’s file system, so I can’t use it to create and save a file.
my next approach was to send the editor contents to the server, save it as a file and then send it back to the user.
since I don’t want the page to refresh I used an AJAX method to save the design.
now at the OnSucceed javascript function I activated an hidden iframe which retrieves the file from server, but this activates an IE security warning…
I’ve tried to fire both method and iframe at the same time now there are no warnings, but the iframe gets executed always before the AJAX method…
is there any other way to do this? am I missing something simple…?
EDIT:
I used iframe with UploadPanel as suggested in
I would have gone down a similar route – sending it on a round trip to the server. Indeed, that’s the process by which I’ve implemented all sorts of pages for retrieving files from a server – but I’ve never come across a security warning from stuff I’ve written (but I don’t use asp.net).
You didn’t say what the security warning is – nor if SSL is involved in any way.
I suggest you build a test rig where the user just presses a button to trigger the javascript and compile the response from static data on the server – mediated by your code. Note that if you want the file to donwload then you should say so in the response headers e.g.
You might also try returning a mimetype not explicitly supported by the browser to force download:
HTH