Last active
May 5, 2021 15:07
-
-
Save yehgdotnet/d541c60eaa8b6cd9db71e7463ed1bb1c to your computer and use it in GitHub Desktop.
Tampermonkey filesave dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A very fast and easy solution is to use FileSaver.js : | |
1) Add the following line into the ==UserScript== section of your Greasemonkey script | |
// @require https://raw.githubusercontent.com/eligrey/FileSaver.js/master/src/FileSaver.js | |
2) Add the 2 following lines of code to the GM script | |
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); | |
saveAs(blob, "hello world.txt"); | |
This code example will display a dialog box to download a file named "hello world.txt" containing the text "Hello, world!". Just replace this by the file name and the text content of your choice ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment