Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 27, 2025

Enables svg-render.html to function completely offline after first visit, with no UI changes.

Implementation

  • Service Worker (svg-render-sw.js): Caches HTML page and example SVG on install, serves from cache with network fallback
  • Registration: Added ~7 lines to svg-render.html to register worker with feature detection
// Register service worker for offline support
if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register('/svg-render-sw.js')
        .catch((error) => {
            console.log('Service worker registration failed:', error);
        });
}

The Service Worker implements:

  • Install: Cache HTML and example SVG resources
  • Fetch: Cache-first strategy with network fallback
  • Activate: Clean up old cache versions

All functionality (paste SVG, convert, download) works offline after initial online visit.

Original prompt

This section details on the original issue you should resolve

<issue_title>Make svg-render.html available offline</issue_title>
<issue_description>As an experiment which can then apply to others as well.

Instructions to coding agents:

Modify svg-render.html to work offline - with no extra UI, but it should load without a network connection if the user has visited at least once.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 27, 2025

Deploying tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b6309c
Status: ✅  Deploy successful!
Preview URL: https://7a69b1d9.tools-b1q.pages.dev
Branch Preview URL: https://copilot-make-svg-render-offl.tools-b1q.pages.dev

View logs

Copilot AI changed the title [WIP] Make svg-render.html available offline Add offline support to svg-render.html via Service Worker Oct 27, 2025
Copilot AI requested a review from simonw October 27, 2025 16:38
Copilot finished work on behalf of simonw October 27, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make svg-render.html available offline

2 participants