Add Copy Feed URL

User
add copy feed url in feed url input
Assistant
To add a **"Copy Feed URL"** button next to the Feed URL input that copies the value into the clipboard, you can do this with a bit of HTML and JavaScript.

### โœ… Example Code

<div style="display: flex; align-items: center; gap: 10px;">
  <input type="text" id="feed-url" value="https://example.com/feed.xml" readonly style="flex: 1;" />
  <button onclick="copyFeedUrl()">Copy</button>
</div>

<script>
  function copyFeedUrl() {
    const input = document.getElementById("feed-url");
    input.select();
    input.setSelectionRange(0, 99999); // For mobile devices

    try {
      document.execCommand("copy");
      alert("Feed URL copied to clipboard!");
    } catch (err) {
      alert("Failed to copy!");
    }
  }
</script>

### ๐Ÿ“ Notes:
– `readonly` prevents user from editing the field but still allows copy.
– You can style the button or input further using CSS or frameworks (like Bootstrap or Tailwind).
– Optionally, use `navigator.clipboard.writeText(input.value)` for modern browsers:

navigator.clipboard.writeText(input.value)
  .then(() => alert('Copied!'))
  .catch(() => alert('Copy failed!'));

Let me know if you want this integrated into a specific UI like Concrete CMS, WordPress admin, or Vue component.

Leave a Comment

Your email address will not be published. Required fields are marked *