CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Saveas Dialog box (http://www.codingforums.com/showthread.php?t=276125)

deepsan 10-11-2012 10:47 AM

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>

Philip M 10-11-2012 11:50 AM

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 times are GMT +1. The time now is 03:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.