Code highlighting not working - CORS error

I’m sure it used to be the case that I could make triple-quoted blocks in a forum post with a language specifier and get syntax highlighting, i.e.

```js
// content here syntax highlighted as Javascript
```

```css
// content here syntax highlighted as CSS
```

This no longer seems to work, e.g. my latest reply with some custom JavaScript - I’ve used the language tag but it doesn’t highlight:

Looking at my browser dev tools there’s a console message saying it failed to load the syntax highlighting module:

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: https://qfcommunity.b-cdn.net/highlight-js/community.quickfile.co.uk/8ca560096c2b0ff3f6aa461e5bf6df6ea43921a5.js

and the network tab suggests this is due to a CORS failure - indeed the qfcommunity.b-cdn.net responses don’t have any Access-Control-Allow-Origin. Is this something you can configure on the CDN side?

Hi @ian_roberts

Thanks for bringing this to our attention. This has been fixed -

var success = true;
var successMessage = "All code should now be highlighted correctly";

if(success) {
    alert(successMessage);
}
<?php

$success = true;
$successMessage = "All code should now be highlighted correctly";

if($success)
{
     echo $successMessage;
}
1 Like

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.