Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get the value of the "Title" variable
- var title = GetPlayer().GetVar("Title");
- // Get the value of the "Editor" variable
- var editor = GetPlayer().GetVar("Editor");
- // Create a new Blob object
- var blob = new Blob([editor], { type: 'text/plain' });
- // Create a new anchor element for the download link
- var downloadLink = document.createElement("a");
- // Set the download link attributes
- downloadLink.download = title + ".txt";
- downloadLink.innerHTML = "Download File";
- // Set the href attribute to the URL of the Blob object
- downloadLink.href = window.URL.createObjectURL(blob);
- // Append the download link to the document body
- document.body.appendChild(downloadLink);
- // Click the download link to initiate the download
- downloadLink.click();
- // Remove the download link from the document body
- document.body.removeChild(downloadLink);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement