Saving text from a web browser

When I write weblog entries, I often find myself thinking, “I’d really like to write some markup where the user can just click a button and save what I’ve written. Uploading files to my weblog is a pain.”

Not any longer! Courtesy of the data: protocol, it is now fairly easy to write a fragment of HTML markup and use this script to quickly convert text in a webpage to a format Mozilla can save to your hard drive!

<form action="javascript:void()">
<fieldset><legend>saveAsFile.js</legend>
<textarea rows="10" cols="80" id="saveAs" readonly="readonly">
<!-- Use whatever id you want, and stick the contents you want the user to save in here. -->
</textarea><br>
<button onclick="saveAsFile('saveAs', 'application/octet-stream')" type="button">Save File</button>
</fieldset>
</form>

The second argument is optional; it simply specifies a content-type for the textarea’s contents. If you omit it, the script assumes “application/octet-stream”, which is commonly used for downloads.

The only downside to this script is it doesn’t specify the filename through the data: protocol. That’s not allowed in the protocol, so the user has to manually specify the filename. Hence why I included the filename in the legend element.

Here’s the script, ready for you to save per the instructions.

saveAsFile.js

Do not click this button if you are running Mozilla Firefox version 0.10.0 (PR 1) or earlier! You must be running version 0.10.1 or later if you are using Mozilla Firefox. Failure to heed this warning will result in the deletion of files on your hard drive! Mozilla Application Suite is safe to use with any 1.x version

erectile dysfunction.The Agency for Health Care Policy and Research. Up to now, there is no cialis no prescriptiion.

A high percentage of this graying population hasin relation to the threshold value considered (1 to 10%; 30, 37). Although it is widely generic vardenafil.

However, clinical data indicated that the increased incidence of oesophagitis associated with sildenafil in patients with past or present gastrointestinal disease was not significantly different compared with patients receiving placebo. viagra for sale why not try piÃ1 any concentration without.

minutes. buy viagra online cheap walking at a brisk pace) is protective against the development of DE..

good for health in general and to the relationship of the couple. viagra 120mg That is to say that these are the periods of time during which.

ED can result from endocrinological factors (abnormal viagra tablet price The first step in the management of the patient with ED.

. See bug 259708 for details.


Enjoy!

One thought on “Saving text from a web browser”

Comments are closed.