0

I am using .aspx page, i want to save some data on button click, which i extracted using function

 function save() {
            var t1 = document.getElementById('test').innerHTML;
            alert(t1);
        }

to .text file, .html file some folder on desktop. the folder should appear, where i can save the file with any extension of .text or .html.

1
  • TJHeuvel:- i want to save a particular portion of page as an template to the folder, that need to re attach on template selection to the same element. Commented Nov 3, 2011 at 14:07

2 Answers 2

3

Javascript in the browser has no file i/o capabilities. The best you can do is popup a window with just the text you want to save and then save using the browser or send the text to the server and have it serve up the appropriate download mime-type as a new page.

Sign up to request clarification or add additional context in comments.

1 Comment

But i want to save it to desktop folder with user choice extension, like .text or .html. that he can re-add to save element on template selection from the folder to the same element, where i extracted this data from.
1

You can't with javascript. You'll have to send the data file server side. See C# Asp.net write file to client.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.