The only place I can get it to run is in Chrome. Wont work in Adobe reader, Firefox, evince etc. Seems most people that do this 'coding in a PDF' only target chrome as a runtime.
Not sure if theres a reason for that like chrome allows more code execution within a document or something?