You can use the same code for server-side rendering: with dvi2html, you can run TeX on a .tex file to get .dvi and then produce a static html file. This renders not just the math but also the text using TeX's layout engine, which is often not what people want. Running it in the client means the TeX knows the width of the view.
>> Running it in the client means the TeX knows the width of the view.
+1 for running it server side. But knowing the width of the view was never supposed to be a thing with HTML and the web. That's what the layout engine in the browser is for. Also, knowing those metrics is a bit or two of fingerprinting information that the server should never be made aware of in the first place.