Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

event that catches anything

Status
Not open for further replies.

lwfg

Programmer
Feb 9, 2009
52
US
Is there a way of detecting any user acivity on a screen - like a slight movement of a mouse that isn't near a text element ?
 
Hi

lwfg said:
Is there a way of detecting any user acivity on a screen
You mean, anywhere, even if outside the browser window ? Or in the browser window, but in a different tab ?

Certainly not with standard JavaScript. However, some proprietary Explorer things may be able to do it...

Anyway, personally I can not imagine a reason for doing that. Do you have one ?

Feherke.
 
Hi

Dan said:
How about a screensaver for a JavaScript app in full-screen or Kiosk mode?
And the next step will be to add password protection to the screensaver ?

No, I do not believe that is a task for a document or the script embedded in a document.

Feherke.
 
Feherke, I need to clear the screen after a period of inactivity - the pages display confidential info. I think I have a way to do it but am curious about detecting no activity another way.
 
Hi

Got it.

The solution I saw for such case was for a page only accessible for registered users, something like this :
JavaScript:
[gray]// starting from the moment of page loading...[/gray]
window[teal].[/teal]onload[teal]=[/teal][b]function[/b][teal]()[/teal] [teal]{[/teal]

[gray]// ... display warning after 9 minutes[/gray]
  window[teal].[/teal][COLOR=darkgoldenrod]setTimeout[/color][teal]([/teal][b]function[/b][teal]()[/teal]
    [b]with[/b] [teal]([/teal]document[teal].[/teal][COLOR=darkgoldenrod]getElementById[/color][teal]([/teal][green][i]'warning'[/i][/green][teal]))[/teal] [teal]{[/teal]
      innerHTML[teal]=[/teal][green][i]'You will be automatically signed out shortly. To keep working, use Save Draft now.'[/i][/green]
      style[teal].[/teal]display[teal]=[/teal][green][i]'block'[/i][/green]
    [teal]}[/teal]
  [teal]}[/teal][teal],[/teal][purple]9[/purple][teal]*[/teal][purple]60[/purple][teal]*[/teal][purple]1000[/purple][teal])[/teal]

[gray]// ... then reload & sign out after 10 minutes[/gray]
  window[teal].[/teal][COLOR=darkgoldenrod]setTimeout[/color][teal]([/teal][b]function[/b][teal]()[/teal] [teal]{[/teal]
    location[teal].[/teal]href[teal]=[/teal][green][i]'/logout/'[/i][/green]
  [teal]}[/teal][teal],[/teal][purple]10[/purple][teal]*[/teal][purple]60[/purple][teal]*[/teal][purple]1000[/purple][teal])[/teal]

[teal]}[/teal]

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top