[thelist] JS: Un-caching a window's HTTP authentication

Oliver Lineham oliver at lineham.co.nz
Fri Jun 8 03:47:45 CDT 2001


At 19:19 3/06/2001 -0600, you wrote:

><input type=button value="LOGOUT"
>onclick=location="http://dummyUN:dummyPW@domain.com/dir/dummy.html">
>
>should fail, clearing the cached un/pw and returning a "failed" msgbox.
>You could put a logout button/link on a page inside the dir to a page
>outside the dir and use an onload event on that outside page to send the
>un:pw at domain location string. That would leave them stranded on that

thanks keith, that was the general approach i used in the end.

actually the system has a navigation frame, so what i did was just provide 
a "switch user" link to the front page, targetting the content frame.

actually actually, i didn't like the way the new login box defaulted the 
username to "dummy" (or whatever was in the link) and the cursor sitting in 
the password field.  so I used onClick="changeUser()" on the link with the 
script:


  username = 'enter username';

  function changeUser() {
         newusername = prompt('Username:','');

         document.all.changeuseranchor = 'http://' + newusername + 
':dummy at prometheus.saturn.co.nz/noc-cgi/overview.cgi';
         document.all.changeuseranchor.target = 'canvas';

  }

this gives two prompts - first a JS one to get the username, then the real 
login box.  a bit of a hack, but hey.


next question:  does anyone know how to retrieve the HTTP authent username 
with JS? i can't find it in the API.  just so i can display the current 
username in that nav frame without the nav having to be a CGI (too slow).

</ol>

____________________________________________________
  phone +64 21 210-7845       http://www.vibe.co.nz/
  po box 10-492              wellington, new zealand




More information about the thelist mailing list