Gildas 2 vuotta sitten
vanhempi
sitoutus
64a4d15104
1 muutettua tiedostoa jossa 5 lisäystä ja 5 poistoa
  1. 5 5
      faq.md

+ 5 - 5
faq.md

@@ -18,6 +18,11 @@ These elements need JavaScript to work properly. By default, SingleFile removes
 ## Why isn't the infobar displayed / Why cannot I save a page from the filesystem in Chrome?
 ## Why isn't the infobar displayed / Why cannot I save a page from the filesystem in Chrome?
 By default, Chrome extensions are not allowed to access to pages stored on the filesystem. Therefore, you must enable the option "Allow access to file URLs" in the extension page to display the infobar when viewing a saved page, or to save a page stored on the filesystem.
 By default, Chrome extensions are not allowed to access to pages stored on the filesystem. Therefore, you must enable the option "Allow access to file URLs" in the extension page to display the infobar when viewing a saved page, or to save a page stored on the filesystem.
 
 
+## How does the self-extracting ZIP format work?
+The self-extracting ZIP files created by SingleFile are essentially regular ZIP files. They take advantage of the flexibility in the ZIP specification, which allows for additional data to be included before and after the main payload. In the case of SingleFile, this feature is used to make the ZIP file appear as an HTML file. As a result, the resulting HTML page is technically invalid because it contains binary data, but it's within the bounds of the HTML specification to allow for such cases. Within this file, there is also a script designed to extract the ZIP payload when the page is opened in a web browser.
+
+The purpose of this script is to interpret the ZIP payload as binary data and then extract it. Initially, the script can use the `window.fetch()` method to read the page in binary form. However, this method doesn't work as expected in Chromium-based browsers when the page is accessed from the local file system due to security restrictions. To circumvent this, the page is encoded in windows-1251, and binary data is directly retrieved from the Document Object Model (DOM). The choice to use windows-1251 encoding, rather than UTF-8, was made because, in UTF-8, any invalid characters are converted into the "U+FFFD REPLACEMENT CHARACTER," making it impractical for this specific purpose due to potential data loss. With windows-1251 encoding, all bytes can be successfully recovered. In any case, all instances of CR and CR+LF characters are replaced with LF characters. As a result, additional data needs to be incorporated into the page to restore these characters. This task is accomplished by the `<sfz-extra-data>` tag, which contains both the necessary data and the offset specifying the start of the ZIP payload encoded in base64.
+
 ## What are the permissions requested by SingleFile for?
 ## What are the permissions requested by SingleFile for?
 The permissions requested by SingleFile are defined in the [manifest.json](https://github.com/gildas-lormeau/SingleFile/blob/master/manifest.json) file. Below are the reasons why they are necessary.
 The permissions requested by SingleFile are defined in the [manifest.json](https://github.com/gildas-lormeau/SingleFile/blob/master/manifest.json) file. Below are the reasons why they are necessary.
  - `identity`: allows SingleFile to connect to your Google Drive account.
  - `identity`: allows SingleFile to connect to your Google Drive account.
@@ -36,8 +41,3 @@ The default configuration of SingleFile is optimized to produce small pages. Thi
 You can also disable the options below. Some resources (e.g. images, frames) on the page may be missing though.
 You can also disable the options below. Some resources (e.g. images, frames) on the page may be missing though.
  - HTML content > remove frames
  - HTML content > remove frames
  - Images > save deferred images
  - Images > save deferred images
-
-## How does the self-extracting ZIP format work?
-The self-extracting ZIP files created by SingleFile are essentially regular ZIP files. They take advantage of the flexibility in the ZIP specification, which allows for additional data to be included before and after the main payload. In the case of SingleFile, this feature is used to make the ZIP file appear as an HTML file. As a result, the resulting HTML page is technically invalid because it contains binary data, but it's within the bounds of the HTML specification to allow for such cases. Within this file, there is also a script designed to extract the ZIP payload when the page is opened in a web browser.
-
-The purpose of this script is to interpret the ZIP payload as binary data and then extract it. Initially, the script can use the `window.fetch()` method to read the page in binary form. However, this method doesn't work as expected in Chromium-based browsers when the page is accessed from the local file system due to security restrictions. To circumvent this, the page is encoded in windows-1251, and binary data is directly retrieved from the Document Object Model (DOM). The choice to use windows-1251 encoding, rather than UTF-8, was made because, in UTF-8, any invalid characters are converted into the "U+FFFD REPLACEMENT CHARACTER," making it impractical for this specific purpose due to potential data loss. With windows-1251 encoding, all bytes can be successfully recovered. In any case, all instances of CR and CR+LF characters are replaced with LF characters. As a result, additional data needs to be incorporated into the page to restore these characters. This task is accomplished by the `<sfz-extra-data>` tag, which contains both the necessary data and the offset specifying the start of the ZIP payload encoded in base64.