Alt

Results 237 comments of Alt

I think HTTP/2 support should be added by the next Node.js LTS release, in 2 months. The current Node.js 17 already uses OpenSSL 3.0 and some requests can't bypass Cloudflare...

It looks that all Fetch API specs are actually Fetch API specs mixed with "Browser requests behaviour specs". The great example is ["Fetch Metadata Request Headers"](https://www.w3.org/TR/fetch-metadata/) spec, which actually is...

UPD. Not only a space character, but other chars too (which should be encoded). For example, if I have `[image] example 1—1.png` then I should include it as `%5Bimage%5D%20example%201%E2%80%941.png`.

It's possible just to add one optional parameter to the constructor — current `location` to resolve `href` relatively to it. I think `href` is one of the frequently used keys...

> the browser native DOMParser doesn't support constructor arguments It just ignores them. So, I think it's safely to extend the constructor. The code will be compatible with the browsers....

### How it looks in File Explorer With `[{hostname}] {YYYY}.{MM}.{DD}—{title}`: ![Screenshot](https://user-images.githubusercontent.com/16310547/105573175-c0f40200-5d6c-11eb-896c-ff6410891c75.png) With just `{title}`: ![Screenshot_1](https://user-images.githubusercontent.com/16310547/105573181-ccdfc400-5d6c-11eb-9773-150009036046.png) --- _Note: it are the old screenshots, so here [hostname](https://developer.mozilla.org/en-US/docs/Web/API/Location/hostname) is with "www"._

Also I use such approach to name files in my userscripts which download files. In particular, in my public userscript for Twitter. Here is a detailed description of the advantages...

But it's only a few lines of code in [background.js](https://github.com/vsDizzy/SaveAsMHT/blob/master/extension/background.js) with simple logic: ```js const {hostnameTrimmed, siteTitle, YYYY, MM, DD} = getFilenameParts(tab) const filename = `[${hostnameTrimmed}] ${YYYY}.${MM}.${DD}—${siteTitle}.mht` let blob =...

Using ```js const a = document.createElement('a') a.download = filename a.href = URL.createObjectURL(blob) a.click() setTimeout(() => URL.revokeObjectURL(a.href), 5000) ``` instead of https://github.com/vsDizzy/SaveAsMHT/blob/524c606aec57378740ebd470b2edc3a077815dac/extension/background.js#L11-L16 correctly saves the file.

The alternative fix: ```js function download(filename, blob) { chrome.downloads.download({ conflictAction: 'prompt', filename: filename, saveAs: true, url: URL.createObjectURL(blob), }, downloadId => { if (downloadId === undefined) { const a = document.createElement('a')...