If by "does not work here" you mean Stackoverflow's snippets, then that is due to the restrictions SO has on cross origin and frame based actions. If the code works, it will be runnable from your own server.