What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-27 22:25:20
javascript download string as file
function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none'; ... Add solution -
Javascript 2022-03-05 13:00:02
javascript download file
function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none'; ... Add solution -
Javascript 2022-02-27 23:00:02
js copy to clipboard cross browser
/** copy text to the clipboard */ function copy2clipboard( text, callback /* optional */ ) { // use modern clipboard API if ( navigator.clipboard ) { navigator.clipboard.writeText( text ) .then( function(){ // if a callback is provided, call it ... Add solution -
Javascript 2022-01-23 05:20:46
how to import js via script in react
import { useEffect } from 'react'; const useScript = url => { useEffect(() => { const script = document.createElement('script'); script.src = url; script.async = true; document.body.appendChild(script); return () => { ... Add solution -
Java 2021-11-16 12:27:21
copy text from header tag in javacript
function copyText() { var text = document.getElementById("myText").innerText; var elem = document.createElement("textarea"); document.body.appendChild(elem); elem.value = text; elem.select(); document.execCommand("copy... Add solution -
Javascript 2021-11-13 07:21:33
content disposition attachment javascript fetch download "excel"
download(filename) { fetch(url , { headers }) .then(response => response.blob()) .then(blob => URL.createObjectURL(blob)) .then(uril => { var link = document.createElement("a"); link.href = uril; link.download = filename + "... Add solution -
Javascript 2021-11-09 05:39:24
chrome bookmarklet copy text
// This needs to be minified (and prefixed) to work // I just put the full function here to better show what the code is doing // Use the bottom line of code and replace "Text To Copy" with your own // text and you're good to go! (function (t... Add solution