The easiest way to do this is to not use javascript for everything in the first place and to actually generate html instead of expecting people to run your code, then having to do it yourself in a convoluted workaround when they won't or can't.
Addendum: That is, if your loads are large enough of course. Small projects will not have scaling problems either way.