js bookmarklet that listens for a particular action (in this case submitting a form)

To clarify, I am talking about listening for any action by the web user on any page. The function would then listen for all form submits and delegate to another function when it encounters the form submit url it is looking for.

Answers


A bookmarklet is just a piece of JavaScript triggered by a user. Just do what you would normally do in order to listen for form submissions (call addEventListener on them).

A bookmarklet operates only on the page upon which it is run. You need a browser extension if you want something that will run automatically on every page that the user visits.


This

var forms = document.getElementsByTagName("FORM");
for (var i = 0, iMax = forms.length; i < iMax; ++i) {
   forms[i].addEventListener("submit", yourFunction, false);
}

...should trigger yourFunction before any form submitting.


Need Your Help

generate random number in a range in assembly

assembly random masm irvine32

I'm trying to genarate a random number between -27 and +33 in assembly.