htmlcssfontswoff

Unable to download custom font from website for offline use


I'd like to download HTML content from a website for learning Chinese so that I can integrate it into my learning materials and use it offline on my commute. The challenge is that the website uses custom fonts for some of the characters that out outside of the regular unicode range covered by most fonts. This is for private educational use to materials that are already accessible, so I'm sure it's legal in my jurisdiction under the fair use exception to copyrights.

I reviewed the source code and found the CCS showing the link to the.

@font-face {
    font-family: FontName;
    src: url(/blablabla/blablabla/fontfilename.woff);
    unicode-range: U + 3400-4DB5
}

However, when I reconstruct the link by adding it to the website's domain (https://domainname.com/) and try to open the file in Safari (https://domainname.com//blablabla/blablabla/fontfilename.woff), I get the following message:

Forbidden

You don't have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Obviously, Safari can access the file to display the missing characters but not when I try to download it.

Does anyone know what's going on? Is there anything I can do to to get the file? This font is just an example, there are a couple of different sets that I need to download to make the site work.

I'm out of my depth so any ideas are appreciated.


Solution

  • Ok, I did manage to answer my question. It had nothing to do with incorrect address. It turns out that I only run into this problem in Safari. When copying and pasting the same link into Firefox, the file would download. However, there is a caveat. The webpage must have accessed the font in the first place (i.e. it is not enough that the font's address be specified in the CCS section, instead, at least one glyph from the font must be used).

    If I tried to download a font before Firefox used it to display at least one character, I'd run into the same authorisation error. However, once Firefox accessed the font at least once, I could download it without problems. Safari, on the other hand, did not let me open the link no matter what.

    I hope this helps someone some day. Cheers!