Skip to content

Fonts do not load in firefox when docs are accesed from a file url #5706

Closed
@jendrikw

Description

@jendrikw

When using cargo doc --open, the docs are generated and placed in target/doc and the url file:///path/to/project/target/doc/cratename/index.html is opened in the default browser.
Due to CORS restrictions, Firefox does not allow pages from file urls to access fonts further up in the directory tree, so the fonts in target/docs are not loaded.

The docs then look like this:
image

I found some an archived artivel on MDN describing the policy: https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs. When setting the key security.fileuri.strict_origin_policy to false, the fonts get loaded as expected.

A solution would have to change the directory structure of the output, or move the index.html one level up. I am not sure how documentation of workspaces is handled.

Debug info:
cargo 1.29.0-nightly (af9e40c 2018-07-05)
Firefox 61.0.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions