1. First create a page and create a region with (Type: Static Content).
2. Create a textarea type item. (Name: P21_CONTENT )
3. Then copy-pest the JavaScript code into Page >>JavaScript >>Function and Global Variable Declaration.
(function () {
var textFile = null,
makeTextFile = function (text) {
var data = new Blob([text], {type: 'text/plain'});
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
};
var create = document.getElementById('create'),
textbox = document.getElementById('P21_CONTENT');
var link = document.getElementById('downloadlink');
link.href = makeTextFile(textbox.value);
link.style.display = 'block';
})();
4. P21_CONTENT it is the CSS ID of P21_CONTENT of textarea item.
5. Create a button with Behavior>>Action>>Submit Page. And another one button for clearing the data of the textarea.
6. Then copy-pest the HTML code into the Region >> Source
<a download="info.txt" id="downloadlink" width="107"
height="10" ><b>Download</b></a>
JOB DONE...
Now you can see a page like this. Here you write any thing on the textarea and click on Generate Text button. Finally Click on Download link.
Demo:
1.
2.
If Not Working You One Please Comment or Contact With Me.
For any type of mistake Advance Sorry and Please inform me.