473,581 Members | 6,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing all web page Events using JavaScript

2 New Member
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 5752
gits
5,390 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Moderator MVP
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
3455
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 Basically, I have to see if someone is navigating away from our page under very specific circumstances, and pop-up a window. I need more...
3
10557
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 keydown and keypress events in Firefox, but then I can't seem to get the key code. I also don't know if the window.event.srcElement.type works with...
4
11991
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 problem in Firefox, not IE. I do know it's possible because Blogger.com's rich text editor does it, but their code is cryptic and separated into like 20...
7
20364
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 browsers? The script bellow is IE only. It fails FF 1.0 and NN 7. Also, if I can trap the keypress I would like to use it to tab to the next...
1
1427
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 extra info from the user and add it to a new table in the database. The old control should not be re-written (at least not now..), so I need a way...
10
6000
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 code is in C#/ASP.NET. TIA. Andrew.
1
1412
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 buttons, links etc. Is there any way you can capture the exiting of a page/the moment the server receives a request to move away from a particular url ?...
2
2272
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 where you can type "r" anywhere on the page while viewing a message and it will open a reply box, but if you type an "r" while entering text into a...
0
1080
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 Dialog? In other words, I need to do something if user clicked "Print" or "Cancel", etc. I'm new to ASP.NET, so any sample code would be...
0
7854
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8296
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8157
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6539
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5665
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5350
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3794
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1394
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1119
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.