A client side javascript that redirects to Logout.aspx

Posted on 2004-05-01
Last Modified: 2008-02-26
Could anyone help me with some piece of javascript code? I need to create a client side javascript that will redirect to Logout.aspx  20 minutes after the current page was rendered.
And where do I have to call that javascript? On <body load=> ?
Question by:Cali_Salas
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 53

Accepted Solution

COBOLdinosaur earned 50 total points
ID: 10968641
<body onload="setTimeout('yourfunction()',20000)">

And your function would go in the head like this:

<script type="text/javascript">
function yourfunction()
// any code you want to execute before logging them off


Author Comment

ID: 10968776
Thanks, but what about if there's a previous javascript function onload ? In my case, I already call another javascript function:

<SCRIPT language="javascript">
function SaveScroll()
    document.all.item('txtScroll').value = theBody.scrollTop
function SetScroll()
    theBody.scrollTop = document.all.item('txtScroll').value

<body id="theBody" onscroll="Javascript:SaveScroll()" onload="Javascript:SetScroll()">

Is there any other place where I could put "setTimeout('LogoutFunction()',20000)" ?
LVL 53

Assisted Solution

COBOLdinosaur earned 50 total points
ID: 10968818
You can put any legal sequence of javascript instruction in the event invocation.  I removed the javascript: as it is unnecessary for events becaue they us assume javascript already:

<body id="theBody" onscroll="SaveScroll()"

LVL 53

Expert Comment

ID: 10971636
Glad I could help.  Thanks for the A. :^)


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question