Add autoregister variable to javascript