Skip to content

Commit

Permalink
Merge pull request #36 from jeremyredhead/master
Browse files Browse the repository at this point in the history
Fix & Improve window.URL polyfill
  • Loading branch information
sammacbeth authored Aug 19, 2019
2 parents db4f597 + 4ae4e95 commit 03a69f2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions window/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ import Spanan from 'spanan';

window.DatArchive = createDatArchiveApi(proxy);

window.URL = urlParse;
let urlTest = new window.URL('dat://example.com');
if (urlTest.hostname !== 'example.com' ||
urlTest.origin !== 'dat://example.com') {
let originalURL = window.URL;
let newURL = urlParse;

newURL.createObjectURL = originalURL.createObjectURL;
newURL.revokeObjectURL = originalURL.revokeObjectURL;

window.URL = newURL;
}

})(window);
})(window);

0 comments on commit 03a69f2

Please sign in to comment.