Can the web browser run a Fortran program?

Actually it can!

If you had asked me this question four months ago I would probably have answered “no” and I would have been wrong.

The answer is yes; browsers can compile and run WebAssembly programs. It works like this:

WebAssembly was standardized recently (the standard was declared final in 2019), but all major browsers have been supporting it since 2017, and compilers exist for Fortran, C, C++, and many other languages. I experimented with a C library. I managed to run the C code at about half the native speed, which is approximately as good as WebAssembly can currently get.

WebAssembly was largely created with games in mind, but its potential for scientific applications is enormous. It’s not without problems, but it works, and I’m really excited about it.