Skip to content

Instantly share code, notes, and snippets.

@amazingandyyy
Created September 19, 2025 17:45
Show Gist options
  • Save amazingandyyy/60f49caad67867f7a285c4d1ecbac3eb to your computer and use it in GitHub Desktop.
Save amazingandyyy/60f49caad67867f7a285c4d1ecbac3eb to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Open & Export</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body { font-family: system-ui, sans-serif; margin: 2rem; line-height: 1.5; }
code { background: #f4f4f5; padding: 0.2rem 0.4rem; border-radius: 4px; }
button { padding: 0.6rem 1rem; border-radius: 8px; border: 1px solid #ddd; cursor: pointer; }
</style>
</head>
<body>
<h1>Open & Export</h1>
<p>This will open the page in a new tab. Then use <strong>⌘P</strong> (Mac) or <strong>Ctrl+P</strong> (Windows) to save as PDF.</p>
<button id="go">Open Page</button>
<script>
const TARGET = new URLSearchParams(location.search).get('url')
|| 'https://example.com'; // fallback target
document.getElementById('go').addEventListener('click', () => {
const win = window.open(TARGET, '_blank', 'noopener');
// We can't reliably auto-print cross-origin; show a nudge after opening:
alert('Page opened in a new tab. Use ⌘P / Ctrl+P to export.');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment