1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00
This commit is contained in:
Kyle Spearrin
2018-06-07 23:36:39 -04:00
parent 8211e19db0
commit f40451ecc5
5 changed files with 23 additions and 7 deletions

View File

@@ -165,7 +165,15 @@ export class Utils {
if (uriString.startsWith('http://') || uriString.startsWith('https://')) {
try {
return nodeURL != null ? new nodeURL(uriString) : new URL(uriString);
if (nodeURL != null) {
return new nodeURL(uriString);
} else if (typeof URL === 'function') {
return new URL(uriString);
} else if (window != null) {
const anchor = window.document.createElement('a');
anchor.href = uriString;
return anchor as any;
}
} catch (e) { }
}