How do I set the proper MIME type?

Currently I have followed all instructions, though I'm getting the following error:

Module loading from 'http://localhost:8000/pkg/testing.js' has been blocked due to a disallowed MIME type ('text/plain')

Currently I have this in my head of the html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

Though the previous:

<html>
  <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
  </head>

Did not work either.

I'm trying to run the code on a python server, in firefox.

How do I fix this issue? I used "wasm-pack build --target web" to create my project.

It is your python server that must set the js files mime type to application/javascript

Im sadly not at all familiar with how to excess that. But I'll look into it, thanks

MIME type of resources is impossible to configure from HTML. You have to change your server's configuration to make it send proper HTTP header.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.