bloburls

How can I revoke an object URL only after it's downloaded?

寵の児 提交于 2021-02-07 14:21:47
问题 I'm saving a file in JavaScript using the following code: var a = document.createElement('a'); a.href = URL.createObjectURL(new Blob(['SOME DATA'])); a.download = 'some.dat'; a.click(); I want to revoke the URL (using URL.revokeObjectURL) once the file is downloaded. When is it safe to do so? Can I revoke it immediately after calling a.click() (which seems to work, but I'm not sure it's safe)? In a 's click event listener? Is there a way to make a click event listener run after the default

How to save .xlsx data to file as a blob

喜夏-厌秋 提交于 2020-05-10 03:50:00
问题 I have a similar question to this question(Javascript: Exporting large text/csv file crashes Google Chrome): I am trying to save the data created by excelbuilder.js 's EB.createFile() function. If I put the file data as the href attribute value of a link, it works. However, when data is big, it crashes Chrome browser. Codes are like this: //generate a temp <a /> tag var link = document.createElement("a"); link.href = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

How to save .xlsx data to file as a blob

喜欢而已 提交于 2020-05-10 03:48:38
问题 I have a similar question to this question(Javascript: Exporting large text/csv file crashes Google Chrome): I am trying to save the data created by excelbuilder.js 's EB.createFile() function. If I put the file data as the href attribute value of a link, it works. However, when data is big, it crashes Chrome browser. Codes are like this: //generate a temp <a /> tag var link = document.createElement("a"); link.href = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

XMLHttpRequest Status of 404 With Blob URL

霸气de小男生 提交于 2019-12-22 11:12:31
问题 I'm trying to upload a blob URL generated by getUserMedia to the server. Someone else wanted to do the same thing, and that question has been answered. I am using the same code for the XHR request as the person who answered that question, but I'm getting a 404. I made a fiddle, and the same thing happens when you look at the console. I have a live example on my site as well, and the same thing happens. Here is the piece of code that needs some TLC: function XHR(){ var xhr = new XMLHttpRequest

Windows Edge and opening a blob url [duplicate]

守給你的承諾、 提交于 2019-12-18 13:16:24
问题 This question already has answers here : Open links made by createObjectURL in IE11 (4 answers) Closed 2 years ago . I'm getting some odd results when trying to open a new window with a blob url in Windows Edge (20.10240.16384, which is the version in the IE11 VM supplied by Microsoft). var xhr = new XMLHttpRequest(); xhr.open('POST', sourceUrl, true); xhr.responseType = 'blob'; xhr.onload = function(e,form) { if (this.status == 200) { var blob = this.response; var url = window.URL

How can I make a really long string using IndexedDB without crashing the browser?

血红的双手。 提交于 2019-12-18 01:30:14
问题 I'm writing a web app that generates a potentially large text file that the user will download, and all the processing is done in the browser. So far I'm able to read a file over 1 GB in small chunks, process each chunk, generate a large output file incrementally, and store the growing output in IndexedDB. My more naïve attempt which kept all the results in memory and then serialized them to a file at the very end was causing all browsers to crash. My question is two-fold: Can I append to an

What is a blob URL and why it is used?

别说谁变了你拦得住时间么 提交于 2019-12-17 03:44:36
问题 I am having very problems with blob URL. I was searching for src of a video tag on YouTube and I found that the video src was like: src="blob:https://crap.crap" I opened the blob URL that was in src of the video it gave an error. I can't open the link, but it was working with the src tag. How is this possible? Requirements: What is blob URL? Why it is used? Can I make my own blob URL on a server? If you have any additional details 回答1: Blob URLs (ref W3C, official name) or Object-URLs (ref.

How to download pdf files using selenium java?

限于喜欢 提交于 2019-12-11 04:29:08
问题 Trying to download pdf files using selenium java. I also tried enabling the content settings of the browser but whenever the selenium script opens the browser (chrome/Mozilla), it opens with the default setting i.e. "Download PDF files instead of automatically opening them in Chrome" as disabled while my actual browser setting is enabled. Is there a way to set WebDriver capabilities(which opens as a result of selenium script execution) for the same? Another way, I tried to form an input

Blob url in internet explorer with angularjs

匆匆过客 提交于 2019-12-09 14:45:49
问题 Given this code (from someone else): var module = angular.module('myApp', []); module.controller('MyCtrl', function ($scope){ $scope.json = JSON.stringify({a:1, b:2}); }); module.directive('myDownload', function ($compile) { return { restrict:'E', scope:{ data: '=' }, link:function (scope, elm, attrs) { function getUrl(){ return URL.createObjectURL(new Blob([JSON.stringify(scope.data)], {type: "application/json"})); } elm.append($compile( '<a class="btn" download="backup.json"' + 'href="' +

XMLHttpRequest Status of 404 With Blob URL

孤人 提交于 2019-12-06 00:18:22
I'm trying to upload a blob URL generated by getUserMedia to the server. Someone else wanted to do the same thing , and that question has been answered. I am using the same code for the XHR request as the person who answered that question, but I'm getting a 404. I made a fiddle , and the same thing happens when you look at the console. I have a live example on my site as well , and the same thing happens. Here is the piece of code that needs some TLC: function XHR(){ var xhr = new XMLHttpRequest(); xhr.open('GET',record.src); //404 ??? xhr.responseType = 'blob'; xhr.onload = function(e) { if