Something like https://www.nicehash.com/ but delivered in a manner that they layman can agree to by just clicking "go ahead"?
Or, as is far more likely because people tend to do first and ask later, in small print at the bottom of the page "by opening this page you agree to let us use your CPU and GPU resources for what-ever we want, if you want us to stop using your CPU and GPU resources you can opt out by closing this tab/window"...
In reality, jsMiner is the only JavaScript Bitcoin mining utility of which I'm aware, and it only uses CPU. A modern machine's CPU is only going to yield a hashrate of 5 MH/s or so, which means you'd have to mine for them for 20,000 hours to equal the revenue generated by your eyes being exposed to a traditional ad.
In short, your PC is too slow by several orders of magnitude to make this a viable replacement for traditional ads.