Using TikZ in a browser like MathJax

I'm guessing this has been done in a thread before, but I've just spent two hours reading various threads and cannot get my head around a very basic question. Long story short: I'm trying to create