Skip to content

Instantly share code, notes, and snippets.

@codejake
Last active February 6, 2026 16:50
Show Gist options
  • Select an option

  • Save codejake/c52bbd233cf6afc22c90399e9cb74525 to your computer and use it in GitHub Desktop.

Select an option

Save codejake/c52bbd233cf6afc22c90399e9cb74525 to your computer and use it in GitHub Desktop.
This is a simple agent-generated HTML/JS file designed to defang one or more URLs. You can open it locally in a web browser or host it on a web server. Hope you find it useful.
<!--
This is a simple agent-generated HTML/vanilla JS file designed to defang one or more
URLs. It has no external dependencies. You can open it locally in a web browser or
host it on a web server. Hope you find it useful.
Here's the AGENTS.md I used:
---
- This program defangs one or more URLs pasted into a textarea.
- It provides defanged output in a non-editable textarea that can be easily copied.
- It is composed of HTML, CSS, and vanilla JS only.
- It uses TailwindCSS for tasteful, professional, and minimimalist styling. Look at example.jpg for inspiration.
- The overall design and code should focus on simplicity.
- Minimize or eliminate third-party dependencies, except for Tailwind.
- All code should be in a single file: index.html
- Linking to a CDN for Tailwind is fine.
- Please ask any clarifying questions you need to provide a good answer, but use common sense. Do not ask superfluous questions.
---
- Jake
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Jake Shaw <codejake on github>">
<title>URL Defanger</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-slate-100 min-h-screen p-8">
<div class="max-w-3xl mx-auto">
<h1 class="text-3xl font-bold text-slate-800 mb-4">URL Defanger</h1>
<p class="text-slate-600 mb-6">
Paste URLs below to defang them for safe sharing. Defanged URLs won't be recognized as clickable links in emails, chat, or documents.
</p>
<p class="text-slate-600 mb-6">All processing is done locally on your device. No data is sent to the server or anywhere else.</p>
<label class="block text-slate-800 font-medium mb-2">Paste URLs here:</label>
<textarea
id="input"
class="w-full h-64 p-4 rounded-lg border-0 shadow-sm resize-y focus:ring-2 focus:ring-blue-500 focus:outline-none"
placeholder="Paste your URLs here..."
></textarea>
<label class="block text-slate-800 font-medium mt-6 mb-2">Defanged output:</label>
<textarea
id="output"
class="w-full h-40 p-4 rounded-lg border-0 shadow-sm bg-white text-slate-600 resize-y"
placeholder="Defanged URLs will appear here..."
readonly
></textarea>
<button
id="copyBtn"
class="mt-6 px-6 py-3 bg-blue-500 text-white font-medium rounded-lg hover:bg-blue-600 active:bg-blue-700 transition-colors"
>
Copy Defanged URLs
</button>
</div>
<script>
const input = document.getElementById('input');
const output = document.getElementById('output');
const copyBtn = document.getElementById('copyBtn');
function defang(text) {
return text
.replace(/https?/gi, match => match.replace(/t/gi, 'x').replace(/T/gi, 'X'))
.replace(/\./g, '[.]');
}
input.addEventListener('input', () => {
output.value = defang(input.value);
});
copyBtn.addEventListener('click', () => {
if (output.value) {
navigator.clipboard.writeText(output.value);
const originalText = copyBtn.textContent;
copyBtn.textContent = 'Copied!';
setTimeout(() => {
copyBtn.textContent = originalText;
}, 1500);
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment