473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Capturing all web page Events using JavaScript

2
Hi, my company has a bunch of web pages on which they want to record every DOM event(mouse movement, clicks etc), these pages were written in past and now with minimal editing I need to add listener to capture these events.
Can someone provide an easy and effective way to do this (may be addition of eventlistener at Body tag to capture all bubbled up events, but i am not sure if it will work when stopPropagation method is called by some eventlistener in the chain).
Thanks to every reader of this question
Feb 20 '09 #1
3 5747
gits
5,390 Expert Mod 4TB
you may try to add listeners to the document like this (for FF):

Expand|Select|Wrap|Line Numbers
  1. document.addEventListener('click', function(e) { 
  2.     alert(e.type + ' - ' + e.target.nodeName) 
  3. }, true);
so as you see you would need to register an additional listener for every event-type you want to observe. have a look here for further information. may be that helps?

kind regards

PS: btw. i changed the threadTitle because JAVA != JavaScript.
Feb 21 '09 #2
bsnl
2
Thanks gits
I think handling stopPropagation would be the biggest challenge here (specially in IE), because if a child node stops bubbling of event then I suppose that document level eventhandler will not be called.
I am also looking for a way to dispatch the events (for a replay of actions on a given web page), from one browser-platform type to another.

Please let me know, If there's any site/book that might help in this
Feb 22 '09 #3
acoder
16,027 Expert Mod 8TB
If stopPropagation was called, that means the event didn't take place, so there's no need to record it. Note, though, that IE uses a different model (attachEvent, cancelBubble, etc.) See the following links:
http://www.quirksmode.org/js/events_advanced.html
http://www.howtocreate.co.uk/tutoria...ript/domevents
Feb 23 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bb | last post by:
I need to capture the following events in IE 5+ and Netscape 6: - Enter new address in URL window and click "GO" - Select a favorite - Click "Home" button - Click "Back" or "Forward" button ...
3
by: coolsti | last post by:
Can someone help me enhance this code snippet which works only for IE so that it will also work for Firefox? I have been trying all sorts of things and have gotten to where I can capture the...
4
by: Jay Xx | last post by:
I have an IFrame in design mode. I've tried a bunch of things to capture key presses in that IFrame, but I can't seem to get it. I can capture key presses outside the IFrame fine. I have this...
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
1
by: Jonah Olsson | last post by:
Hello, I'm trying to build an "add-on" to an already existing custom web user control. The old control collects some user data and saves it to a database. The new control should collect some...
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
1
by: louise raisbeck | last post by:
Hi there, i need to ensure a user does something when they exit an asp.net web page. I cant put code behind close buttons, because there are a thousand ways they can exit this page, menu...
2
by: jbigham | last post by:
Hello, I'd like to capture key events using javascript, but don't want to process such events when the user is typing into an input box or into a textarea. As an example, gmail has a feature...
0
by: lvlacic | last post by:
I have button on my asp.net page that invokes PrintDialog like this: <asp:Button ID="Button1" OnClientClick="Javascript:return window.print()" How can I capture the click events from that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.