Skip to content

Commit bcfb5ce

Browse files
committed
add legacy warning when on page loaded from filesystem
1 parent b1ef617 commit bcfb5ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

public/legacy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {XmlElement} from "../editable";
44
import {genBlob} from "../internal/gen";
55
import {mapPoints} from "../internal/util";
66

7-
// TODO check if file (ex. file://...)
87
const isBrowser = new Function("try {return this===window;}catch(e){ return false;}");
98
const isLocalhost = () => location.hostname === "localhost" || location.hostname === "127.0.0.1";
10-
if (!isBrowser() || (isBrowser() && isLocalhost())) {
9+
const isFile = () => location.protocol === "file:";
10+
if (!isBrowser() || isLocalhost() || isFile()) {
1111
console.warn("You are using the legacy blobs API!\nPlease use 'blobs/v2' instead.");
1212
}
1313

0 commit comments

Comments
 (0)