Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Saveas Dialog box

    Hello All

    I have a js function which load a whole letter in a div and have a print button that allow the user to print the letter. I have to add an option that allow the user to save the letter in a location.I was trying to do something like a saveas dialog which the user can save the letter at any location.Can anyone please help me to achieve it.Note that I am using IE8.Thank you, below is part of my code.

    <script type="text/javascript">
    window.onload =function()
    {
    var content = window.opener.LoadLetterinPreview();
    document.getElementById("print").innerHTML=content;
    }
    </script>

    <div id="print" style="border:1px red solid; width:650px;"></div>
    Last edited by deepsan; 10-11-2012 at 10:51 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    JavaScript running in a browser is a client-side language. JavaScript does not have any commands for reading or writing files. Modern browsers can read files on the server using an Ajax call, but otherwise JavaScript has no capability to read from, write to, modify or delete a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.

    Internet Explorer's JScript (only) lets you write to the Windows local file system by means of the harmless execCommand() function. It is possible in IE in certain circumstances to use ActiveX objects to access the directory and read files. This is not recommended for a variety of reasons.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •