Well, there was CoinHive which did this exact thing 6-7 years ago, but that system got abused a bit much