Password Protect an HREF Link

When user click on the link they will ask to enter a password then the link will be displayed. Does anyone know?

<div class='swanky_title__social'>
      <a href='www.link.com target='_blank'> // Link to be password protect
        <div class='slide'>
          <div class='arrow'>
            <div class='stem'></div>
            <div class='point'></div>
          </div>
        </div>
        <img src='www.imgsrc.com'>
        Name
      </a>
    </div>
  </div>

The simplest way to password protect a page or directory, assuming you’re running Apache, is to use .htaccess and .htpasswd. I’m sure IIS and NginX have a similar feature.

hOW DO I DO THAT?

Your host may provide a way to do this. If you have a control panel check it out to see if it provides the option.

If you have to do it manually this link should provide guidance.

Hey I know about this. Just wanna know how to put a password to a link inside of a webpage. Like when the link is clicked it will prompt to enter a password

Does anyone knwo how to do his?

Hi,
You cannot implement a server side password protection upon clicking a link, you could implement it client side with JavaScript but that would not be very secure as the user would only have to disable JavaScript to access the link. The password protection should trigger upon a page request (after clicking the link), and this can be implemented via htaccess as mentioned above.
http://www.htaccesstools.com/articles/password-protection/

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.