Downloaded Manual outputs errors after Search #89619

Closed
opened 2021-07-03 01:26:41 +02:00 by T · 8 comments

Short description of error

After you download an offline copy of the Blender manual and try to search for something, you'll only see titles for results, not the highlighted blurbs of text you see on the website.

Exact steps for others to reproduce the error

  • Go to https://docs.blender.org/manual/en/2.93/
  • Click the Download the manual as web pages (HTML) link
  • Extract the manual
  • Go into the extracted folder, and click on the index.html file
  • Search for something in the left Search docs input. I searched for node.
  • You'll see a bunch of result titles appear but no blurbs
  • Open DevTools and view 828 errors reported. Each error is a failed ajax request to a local file
Access to XMLHttpRequest at 'file:///D:/Projects/3D/Blender/Manual/blender_manual_v293_en.html/interface/window_system/workspaces.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

GET file:///D:/Projects/3D/Blender/Manual/blender_manual_v293_en.html/interface/window_system/workspaces.html net::ERR_FAILED
**Short description of error** After you download an offline copy of the Blender manual and try to search for something, you'll only see titles for results, not the highlighted blurbs of text you see on the website. **Exact steps for others to reproduce the error** - Go to https://docs.blender.org/manual/en/2.93/ - Click the `Download the manual as web pages (HTML)` link - Extract the manual - Go into the extracted folder, and click on the `index.html` file - Search for something in the left `Search docs` input. I searched for `node`. - You'll see a bunch of result titles appear but no blurbs - Open DevTools and view `828` errors reported. Each error is a failed ajax request to a local file ``` Access to XMLHttpRequest at 'file:///D:/Projects/3D/Blender/Manual/blender_manual_v293_en.html/interface/window_system/workspaces.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https. GET file:///D:/Projects/3D/Blender/Manual/blender_manual_v293_en.html/interface/window_system/workspaces.html net::ERR_FAILED ```
Author

Added subscriber: @Noxx

Added subscriber: @Noxx
Author

As a side note. The site calls out

Please report any website-related bugs on developer.blender.org, setting the tag to Infrastructure: Blender.Org (not BF Blender).

There was no option to set the Tag in the form that was linked, so I had to create the issue, then edit it. Not sure if it's something you're able to add in, but adding a dropdown with available tags or at the least a Tags input may clear up some confusion.

As a side note. The site calls out >Please report any website-related bugs on developer.blender.org, setting the tag to Infrastructure: Blender.Org (not BF Blender). There was no option to set the Tag in the form that was linked, so I had to create the issue, then edit it. Not sure if it's something you're able to add in, but adding a dropdown with available tags or at the least a Tags input may clear up some confusion.
Author

Another note. I was poking around search.html and google-analytics code is being exported with the docs. Can't think of valid reasons why that'd need to be there for offline files.

Another note. I was poking around `search.html` and `google-analytics` code is being exported with the docs. Can't think of valid reasons why that'd need to be there for offline files.

Added subscriber: @Blendify

Added subscriber: @Blendify

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Aaron Carlisle self-assigned this 2021-07-23 04:27:28 +02:00

This is a security feature built-in to most browsers you can get around this by running chrome from the command line with --allow-file-access-from-files (there may be a way to do this from chrome settings too)there are other ways around this too such as creating a localhost server. If this is something that matters to you I would either use the command line trick or compile the user manual yourself, see: https://docs.blender.org/manual/en/latest/about/contribute/build/index.html

https://stackoverflow.com/questions/20041656/xmlhttprequest-cannot-load-file-cross-origin-requests-are-only-supported-for-ht

Unfortunately, there is nothing that can be done from the ourside to fix the cors policy issue.

In #89619#1186337, @Noxx wrote:
Another note. I was poking around search.html and google-analytics code is being exported with the docs. Can't think of valid reasons why that'd need to be there for offline files.

When you have the docs downloaded google analytics won't track you, if you look in the console logs you should see Failed to load resource: net::ERR_BLOCKED_BY_CLIENT this is the analytics script being blocked. Because google blocks anything that doesn't come from docs.blender.org here there is no point in removing it for downloaded files. It also would be a lot more work to generate two copies of the documentation.

This is a security feature built-in to most browsers you can get around this by running chrome from the command line with `--allow-file-access-from-files` (there may be a way to do this from chrome settings too)there are other ways around this too such as creating a localhost server. If this is something that matters to you I would either use the command line trick or compile the user manual yourself, see: https://docs.blender.org/manual/en/latest/about/contribute/build/index.html https://stackoverflow.com/questions/20041656/xmlhttprequest-cannot-load-file-cross-origin-requests-are-only-supported-for-ht Unfortunately, there is nothing that can be done from the ourside to fix the cors policy issue. > In #89619#1186337, @Noxx wrote: > Another note. I was poking around `search.html` and `google-analytics` code is being exported with the docs. Can't think of valid reasons why that'd need to be there for offline files. When you have the docs downloaded google analytics won't track you, if you look in the console logs you should see `Failed to load resource: net::ERR_BLOCKED_BY_CLIENT` this is the analytics script being blocked. Because google blocks anything that doesn't come from docs.blender.org here there is no point in removing it for downloaded files. It also would be a lot more work to generate two copies of the documentation.
Author

I'm a developer, I'm aware of certain Browser security features.

Depending on how the static pages are generated, extra logic could be added for the offline files to inline files or data into one file so that no external access is required. The JS that's used to search and view results, could then just point to the inlined data.

To that same point, logic could be added to not include extraneous scripts, like analytics.

I'm a developer, I'm aware of certain Browser security features. Depending on how the static pages are generated, extra logic could be added for the offline files to inline files or data into one file so that no external access is required. The JS that's used to search and view results, could then just point to the inlined data. To that same point, logic could be added to not include extraneous scripts, like analytics.

The tool used to generate the docs is known as Sphinx, the javascript for generating the previews can be found on GitHub: https://github.com/sphinx-doc/sphinx/blob/4.x/sphinx/themes/basic/static/searchtools.js#L280

The analytics is injected by the theme we use which can also be found on GitHub: https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L237

If you have ideas on how these can be improved please create patches or tasks in the main repositories for each of the features.

The tool used to generate the docs is known as Sphinx, the javascript for generating the previews can be found on GitHub: https://github.com/sphinx-doc/sphinx/blob/4.x/sphinx/themes/basic/static/searchtools.js#L280 The analytics is injected by the theme we use which can also be found on GitHub: https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L237 If you have ideas on how these can be improved please create patches or tasks in the main repositories for each of the features.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/blender-org#89619
No description provided.