Create a "Login" anchor link

If you have domino sites that do not explicitly require the user to login, but you want to create a link to let them do so at will, then this may be helpful.....

It makes use of the fact that you can append "&login" to a URL and it will cause the server to authenticate the user.

First, create a link on the form that calls the JavaScript function. You can do this with the following text on the form and mark it as PassThru HTML:

<a href="JavaScript: doLogin()">Login</a>

Now place the following function into your JavaScript library or place it within SCRIPT tags in the document's HEAD.

function doLogin() {
s = document.location.search;

//Check '&Login' not already in URL!
if (s.toLowerCase().indexOf("&login") ==
-1 ) {
//Check that there is a '?Open' part to append to
a = (s=="") ? "?Open&Login" : "&Login";
document.location.href += a;

You can see this in action, as I have placed a little Padlock at the bottom of every page that lets me Login to CodeStore so that I can administer it easily. You won't, however, be able to login as my password is very hard to guess, but you can see the above function's effect on the URL.

Note: Using this may have adverse effects on any paired URL arguments that your forms use. Beware


  1. Login URL for Domino

    I have a site I am working on with a lot of the site available without a login. They want to have the two login fields on the home page so a customer can log in if they want to, then go to a protected area of the site.

    They do not want a custom login page. My alternatives are to create a custom login page using the rest of the home page, or figure a way to pass the username and password thru a URL.

    It looks like your way may work. Do you think I could alter the js to include their username and password then, refresh the page?

    Thanks, DD

      • avatar
      • Jake Howlett
      • Mon 21 Aug 2006

      Re: Login URL for Domino

      Hi Damian,

      Not sure what you mean exactly, but, yes, you should be able to add the username and password to the URL string using this JavaScript.


      Hide the rest of this thread

      1. Re: Login URL for Domino

        Hi to everybody,

        i am new to this and a Lotus notes fresher.

        my interest is to create the customized login form for the web application and that should be available to those user's who are in names.nsf. i did everything but i am unable to capture the password of the user. can any body help me to solve this problem.

        Help me to improve my knowledge to design the web application(for personal use).

        Thanks, To EveryBody

    • avatar
    • Gopi
    • Thu 22 Jul 2010


    the js given above is very usefull. But when used in frameset, it is not working.

    For this to work in frameset, I use "onClick" instead of "href".

    !-- <a href="" OnClick="JavaScript: doLogin();return false;"> --!

    thanks Jake Howlett

Your Comments


Navigate other articles in the category "JavaScript"

« Previous Article Next Article »
None Found   Managing JavaScript "popup" windows

About This Article

Author: Jake Howlett
Category: JavaScript
Keywords: Login; URL;


Print Friendly

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »