SaveAs Command

Saves the current Web page to a file.

Scripting Information

Command SaveAs
User interface Optional. This parameter is ignored. The Save HTML Document dialog box is always displayed.
execCommand vValue Optional. String that specifies the path and file name of the file to which to save the Web page. When the path contains more than one folder name, separate the folder names with two backward slashes (\\).
Applies to execCommandqueryCommandEnabledqueryCommandIndetermqueryCommandStatequeryCommandSupportedqueryCommandValue.

Remarks

The Save HTML Document dialog cannot be suppressed when calling this method from script.

Windows Internet Explorer 7 and later. The file path portion of vValue parameter is ignored.

Example

The following script shows the Save HTML Document dialog box with a suggested filename of Test.html when the user clicks the button.

<script type="text/javascript">
function doSaveAs()
{
    if (document.execCommand) {
        document.execCommand("SaveAs", false, "Test.html");
    }
    else {
        alert('This command is available in Internet Explorer only.');
    }
}
</script>

<button onclick="doSaveAs()">Save this document</button> 

Minimum Availability

Internet Explorer 4.0 and later.