People tried this in 2013 or so, there's no point to it. Doing proof of work in javascript in a browser is so crushingly, pointlessly slow that there's no value at all. Some browsers also intentionally detect attempts to do proof of work and attempt to block it entirely.
> Some browsers also intentionally detect attempts to do proof of work and attempt to block it entirely.
Then they'd be blocking themselves from the website.
https://blog.mozilla.org/en/firefox/block-cryptominers-with-...
Technically true, but the list is mostly nonfunctional - cryptominers are basically extinct in the wild, and most of the domains on the list have expired or no longer serve mining scripts.