I think WebCPU is where it's at. First class virtualization in the browser so you don't have to emulate :)
https://github.com/atrosinenko/qemujs
https://jamesfriend.com.au/pce-js/ibmpc-games/
https://leaningtech.com/webvm-server-less-x86-virtual-machin...
and so on...