Javascript authentication is so weak it shouldn't even be considered. If your server side script works, use it. If .htaccess files work, even better.