javascript autoload not working