So you know how sometimes websites have a little "?variable=value" thing at the end of their name? how do I use this? I'm pretty sure either A) the variable isn't getting deffined like it should or B) there is a problem regarding this portion of the code:
if (! variable) {
var variable;
}
So how do I do this?
EDIT: Here is the full script I'm trying to run, it's purpose is for a simple password protected page, but I want to allow the password to be passed in the url so when switching pages you won't have to re-enter the password continuously.
<script>
var m = location.href.match(/[?&]variable=([^&]*)/),
password;
if (m) {
password = m[1];
}
var pass1="password";
var pass2="abcd";
if (password!==pass1 || password!==pass2) {
password=prompt('Please enter your password to view this page!',' ');
if (password==pass1 || password==pass2) {
alert('Password Correct!');
} else {
history.go(-1);
}
}
</script>
This code just prompts me no matter what is in the url.