Easily copy predefined links with just a little JavaScript and an input box.
Remember to grab the JavaScript from the page body or scroll down to check it out.
If you are recreating these from scratch, make sure you grade the code in the individual embeds as well. Otherwise everything will break.
Share link
Fancy pop-up box
Click me
Share link
The code
Normal Copy Block
Copy the code below and paste it into your Before </body> section on your Webflow page.
<script>
function copyLinkFunction() {
/* Get the text field */
var copyText = document.getElementById("copyLink");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
/* Copy the text inside the text field */
navigator.clipboard.writeText(copyText.value);
/* change button text */
copyBtn = document.getElementById('linkBtn')
copyBtn.textContent = 'Copied!';
}
</script>
Fancy pop-up box
Copy the code below and paste it into your Before </body> section on your Webflow page.
<script>
/* Get the text field */
var fancyText = document.getElementById("fancyLink");
/* Select the text field */
fancyText.select();
fancyText.setSelectionRange(0, 99999); /* For mobile devices */
/* Copy the text inside the text field */
navigator.clipboard.writeText(fancyText.value);
/* change button text */
fancyCopyBtn = document.getElementById('fancyLinkBtn')
fancyCopyBtn.textContent = 'Copied!';
}
</script>