Browse Source

Editor: Simpler workaround for #6594.

Mr.doob 10 years ago
parent
commit
daa7399e0c
1 changed files with 4 additions and 4 deletions
  1. 4 4
      editor/js/Menubar.File.js

+ 4 - 4
editor/js/Menubar.File.js

@@ -278,19 +278,19 @@ Menubar.File = function ( editor ) {
 
 
 	//
 	//
 
 
+	var link = document.createElement( 'a' );
+	link.style.display = 'none';
+	document.body.appendChild( link ); // Firefox workaround, see #6594
+
 	var exportString = function ( output, filename ) {
 	var exportString = function ( output, filename ) {
 
 
 		var blob = new Blob( [ output ], { type: 'text/plain' } );
 		var blob = new Blob( [ output ], { type: 'text/plain' } );
 		var objectURL = URL.createObjectURL( blob );
 		var objectURL = URL.createObjectURL( blob );
 
 
-		var link = document.createElement( 'a' );
 		link.href = objectURL;
 		link.href = objectURL;
 		link.download = filename || 'data.json';
 		link.download = filename || 'data.json';
 		link.target = '_blank';
 		link.target = '_blank';
-		link.style.display = 'none';
-		document.body.appendChild( link );
 		link.click();
 		link.click();
-		document.body.removeChild( link );
 
 
 	};
 	};