mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-26 09:26:22 +00:00
META-425 fixes json download unresponsive in firefox
This commit is contained in:
parent
ec0b5ac309
commit
ed13a4fecf
@ -495,7 +495,22 @@ export default Component.extend({
|
||||
const href = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(policy))}`;
|
||||
const download = `${get(this, 'datasetName')}_policy.json`;
|
||||
const anchor = document.createElement('a');
|
||||
const anchorParent = document.body;
|
||||
|
||||
/**
|
||||
* Post download housekeeping
|
||||
*/
|
||||
const cleanupPostDownload = () => {
|
||||
anchor.removeEventListener('click', cleanupPostDownload);
|
||||
anchorParent.removeChild(anchor);
|
||||
};
|
||||
|
||||
Object.assign(anchor, { download, href });
|
||||
anchor.addEventListener('click', cleanupPostDownload);
|
||||
|
||||
// Element needs to be in DOM to receive event in firefox
|
||||
anchorParent.appendChild(anchor);
|
||||
|
||||
anchor.click();
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user