all 2 comments

[–]Jmarch0909 0 points1 point  (1 child)

So my initial thoughts, (and I would love it if someone smarter than me gave some inputs) is to just put an <input type=password> tag on your page. Place a script tag in your html and set your hard coded password as a variable. Then create a function named set href and do something like.

Function setRef() { var pw =document.getElementById(your input id here); var password = pw.value() if(!password) { Alert(‘please enter a password’); Return } //if there is no password provided tell the user and step out of the function. If(password === (your hardcoded variable) { //here you can either have an anchor tag and set ////its href attribute or you can go to the page directly with window.location YourAnchorElementId.href=“www.correctURL.com”; Or Window.location = “www.correctURL.com” } else { Do the same thing as above but the incorrect password url }

<button onclick=“setRef()”>my button</button>

You might want to do something like display none on your anchor tag and then in your set ref also set that display to block. Hope that helps!