• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 8503
  • Last Modified:

How to invoke "Save As" dialog in Firefox?

Is there a way to invoke the "Save As" dialogue in Firefox? The following works in IE but not Firefox:

function saveFile (fname)
{
      document.execCommand('SaveAs',null,fname)
}

<input type="button" value="Save" onClick="saveFile('otherpage.txt');">

0
mariita
Asked:
mariita
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
have the server return the headers
content-type: application/octet-stream

or do this:

<a href="otherpage.txt" onClick="alert('Please use right mouse and save-as'); return false">Other page - use right-click</a>
0
 
mariitaAuthor Commented:
How do I make the server return the headers?
0
 
Michel PlungjanIT ExpertCommented:
Depends on the server.

You most likely do not want to do a generic change in the server config
    AddType application/octet-stream .txt

instead use a server process (perl, php, .net, jsp) to set the headers and instead have

<a href="servefile.php?file=otherpage.txt">Save text file</a>

Michel
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now