Batakj
Batakj

Reputation: 12743

How to open save dialog from html?

In my project,there is a output page which is a plain html. The result is inside of a DIV. I have to put up save button. On click of save button, save dialog prompt and ask for the name and save the entire HTML excluding the button code.

We have to assume that audience are not acuitance with browser control. We have to provide this mechanism to save the content to their physical drive.

I google it. But, i didn't find any relavant solution.

Thanks in advance. Please help.

Upvotes: 2

Views: 743

Answers (1)

mitchimus
mitchimus

Reputation: 828

You can't, in browser Javascript has no file IO capabilities. This is by design.

You could ask the user to just press CTRL+S or use document.print if you want to print the page. Have a look here as well Programmatically Sending Keys

Upvotes: 4

Related Questions