ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 23rd, 2002, 10:14 AM
Irfan Irfan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 5 Irfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Monitoring Browser Inactivity

Hi,

I have a problem where I want to close the browser window if the user has not performed any activity for five minutes.

I am coding in ASP and also VBScript on NT4, using IIS4.

Is there any way of doing this?

Thanks alot,

Irfan.

Reply With Quote
  #2  
Old May 23rd, 2002, 08:49 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Hi Irgan,
There sure is. You need to use JavaScript however:

<script language="JavaScript">

funciton setCloseTimer()
{
window.setTimeout("window.close()", 300000);
}

</script>

<body onLoad="setCloseTimer()">

....

</body>

That should do it. Play around with the 300000 to match the time required.

Reply With Quote
  #3  
Old May 24th, 2002, 12:46 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
btw the time of 300,000 millisecs is 50min! so just remove on of those 0's to make it 5 mins

have fun

Reply With Quote
  #4  
Old May 24th, 2002, 05:37 AM
Irfan Irfan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 5 Irfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks very much.

Regards,

Irfan

Reply With Quote
  #5  
Old May 24th, 2002, 10:00 AM
Nautilus Nautilus is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Newcastle, UK
Posts: 6 Nautilus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Nautilus
Ben, I think your maths needs brushing up

1 second is 1000 milliseconds, so 1 minute is 60,000 (60 x 1000)
5 minutes is 300,000 (5 x 60000 or three hundred thousand). So Mytch was right.

Your suggestion of 30,000 ms would only be 30 seconds.

Mytch was right again with the setTimeOut function, however using the Timeout after a body onload would close the window regardless of user activity after the set time (5 mins), even if it was being used at the time. Very annoying!!

A better way to use the setTimeout in this way would be to check for mouse movement or key presses, and set the TimeOut if no movement.
Have a function saying something along the lines of:

If mouse_position change / key_press then reset setTimeOut.

Can't think offhand what the actual code would be, but this gives you an idea.
Then call this function in a body onload.

As long as you move the mouse or keep typing the TimeOut resets itself, but if you leave the screen alone for a few seconds, the timeout kicks in, until you type something again.

Hope that helped.

Nautilus

Reply With Quote
  #6  
Old May 24th, 2002, 10:35 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
yeah i realised after i posted and couldnt be bothered to edit it

i was thinkin 1/100 hehe

oh well

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Monitoring Browser Inactivity


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
Stay green...Green IT