Alternative to user:pass@domain.com
Is there an alternative to http://user:pass@domain.com?
I have a php script with a link
<a href='user:pass开发者_StackOverflow@domain.com'>LINK</a>
When I click on it it takes me to the website and saves me having to authenticate every time. It normally has a pop up box. The flaw is that if you hover over the link it shows the user and pass. Is there an alternative that won't do that?
Thanks
Use a password storage application/wallet system to store usernames and passwords. It saves you the hassle of making these kinds of things, and works equally well when the site in question uses something other than basic HTTP authentication.
You can do something similar to this:
HTML code:
<a href="http://www.yahoo.com/" title="">Link 1</a> <a href="#" title="" data-location="http://www.google.com/">Link 2</a>
JavaScript (using jQuery):
jQuery().delegate('a[data-location]', 'click', function(event){ event.preventDefault(); window.location = jQuery(this).attr('data-location'); });
It will just catch clicks on specific links (links, that contain data-location
attributes) and redirect to the location from the data-location
attributes. In the example it should catch only Link 2 and redirect you to www.google.com.
You can't hide part of link if you have basic HTTP authentication
Check http://www.php.net/manual/features.http-auth.php
精彩评论