Skip to content

Commit

Permalink
ugly fix because chrome introduced restrictions on settingg protocols…
Browse files Browse the repository at this point in the history
… for the URL API
  • Loading branch information
chrisj committed Nov 2, 2023
1 parent d0fb712 commit 458dc8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/neuroglancer/datasource/state_share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ export class StateShare extends RefCounted { // call it a widget? no because it
}, responseJson)
.then((res) => {
const stateUrl = new URL(res);
stateUrl.protocol = protocol; // copy protocol in case it contains authentication type
const link = `${window.location.origin}/#!${stateUrl}`;
// ugly fix because chrome introduced restrictions on settingg protocols for the URL API
const [_, noProtocol] = stateUrl.toString().split(stateUrl.protocol);
const stateUrlWithFixedProtocol = `${protocol}$${noProtocol}`;
const link = `${window.location.origin}/#!${stateUrlWithFixedProtocol}`;
navigator.clipboard.writeText(link).then(() => {
StatusMessage.showTemporaryMessage('Share link copied to clipboard');
});
Expand Down

0 comments on commit 458dc8b

Please sign in to comment.