First, you'll want something that the user can activate to trigger the 'save'. We'll assume the user has JavaScript enabled, because this won't work otherwise. In reality, if you were going to add this to your page, you'd want to add the interface component using JavaScript so it wouldn't appear if it weren't going to work...but, like I said, we're going to just make that assumption to save a little time by adding
<button type="button" onClick="saveAs()">Save As...</button>
to our document.Next, we add the following script to our document...
JavaScript
Now, when you click it will automatically download the document as an HTML document, easy peasy lemon squeazy.
Happy coding.
No comments:
Post a Comment