When you create or open a post in Firefox for the first time, the syntax highlighting appears to work as you’d expect. However, if you refresh the page using the refresh button, F5
, or some other method, the syntax highlighting breaks until you leave the page and go back.
For example, if I’m currently viewing a post which contains code and the syntax highlight breaks, I can make it work again by visiting the blog owner’s home page, and then revisit the post from their home page.
I’m not sure if I’m doing something wrong, or if this is a problem with the way write.as works with Firefox. This issue does not seem to appear in Google Chrome.
I currently have no custom themes loaded. I do have Firefox addons, but I loaded up a fresh Firefox profile without addons and the issue still occurred.
When you load a page with syntax highlighting for the first time, here’s the console output:
Loading failed for the <script> with source “https://analytics.write.as/piwik.js”. some-code:1:1
GET https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js
[HTTP/2 404 Not Found 120ms]
The resource from “https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). some-code
Loading failed for the <script> with source “https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js”. some-code:1:1
When you refresh the page using the refresh button, here’s what you get:
Loading failed for the <script> with source “https://analytics.write.as/piwik.js”. some-code:1:1
GET https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js
[HTTP/2 404 Not Found 25ms]
The resource from “https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff). some-code
Loading failed for the <script> with source “https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/c.min.js”. some-code:1:1
Uncaught ReferenceError: hljs is not defined
highlight https://write.as/nyhilum/some-code:100
<anonymous> https://write.as/nyhilum/some-code:141
loadLanguages https://write.as/nyhilum/some-code:116
loadLanguages https://write.as/nyhilum/some-code:106
<anonymous> https://write.as/nyhilum/some-code:141
EventListener.handleEvent* https://write.as/nyhilum/some-code:87
some-code:100:9
I didn’t see any posts mentioning this issue, but I could’ve overlooked something, so feel free to point me in that direction if it exists.