]> git.ardis.lu - zip-page/commitdiff
Use href instead of origin
authorArdis Lu <ardisglu@gmail.com>
Tue, 3 Oct 2023 04:27:09 +0000 (21:27 -0700)
committerArdis Lu <ardisglu@gmail.com>
Tue, 3 Oct 2023 04:27:09 +0000 (21:27 -0700)
Enables offline usage on file: URL scheme

index.html

index 128b5afd40b4b3fb3a37bebca935a182bc5f8853..c4344e16f7628e9369791f8f3ec5c794e201e34f 100644 (file)
       const content = new FormData(e.target).get('content');
       const b64 = await textToGzipBase64(content);
 
-      const url = `${location.origin}/#${b64}`;
+      const url = `${location.href}#${b64}`;
       e.target.elements['url'].innerHTML = `<a href="${url}">${url.substring(0, 60)}${url.length > 60 ? '...' : ''}</a>`;
     });
 
This page took 0.037537 seconds and 4 git commands to generate.