form field (block certain sites)

Subscribe to form field (block certain sites) 9 posts, 3 voices

 
ekbworldwide Scriptwright

Question
Is there an easy way to block certain sites from having form field data saved?

Example
I'd like to block yahoo games. Their spam protection code makes me jump through hoops and I end up with loads of saved data (which is of course is useless) coming up via auto-complete and making everything that much more annoying.

I checked this site and mozilla add-ons I didn't find anything.

 
Aquilax Scriptwright

You can delete private data each time that you close firefox, and inside private data there are also the saved forms informations.
I have never seen something to block form auto completing for specific pages or url like the cookie exceptions, also because normally the forms auto completing is not done over url or page but over form fields names, each time that you type in a text field the form auto completing will suggest all the texts typed in all previous forms fields with the same name independently of domain, url and form.

 
ekbworldwide Scriptwright

>> over form fields names...

I see your point. How about something to block form field names?

 
Mikado Scriptwright

Randomize form element name on focus and revert on blur.

 
Aquilax Scriptwright

Yep, or on page load and form submit :)

 
Mikado Scriptwright

Just keep in mind that you may encounter ajaxy form that doesn't trigger submit event ;)
By the way, removing name should be better - I suppose Firefox doesn't remember input history for an unnamed field?..

 
ekbworldwide Scriptwright

Um. My programming skills are limited. I'm not even sure how I should start on this.

My guess I should start with "focus" and "blur" and come back to this thread once I'm familar with them. Good idea?

http://pastie.caboo.se/195118

The link is the code for the anti-spam thing at yahoo games. The add-on InFormEnter injected a bit of code.

 
Aquilax Scriptwright

I write something on the fly, try it and fix it if there are some bugs ;)


function intiInput(element)
{
  element.nameO=element.name; //original name
  element.nameR=getRandomName(element.name.length); //random name
  element.addEventListener("focus",function(e){var i=e.target;i.name=i.nameR;},false); //set random name
  element.addEventListener("blur",function(e){var i=e.target;i.name=i.nameO;},false); //set original name
}
function getRandomName(length)
{
  var text1="abcdefghkijlmnopqrstuvwxyz0123456789";
  var num1=text1.length;
  var text2="";
  for(var num2=0;num2<length;num2++) text2+=text1[Math.round(Math.random()*num1)];
  return text2;
}

 
Mikado Scriptwright

Turned out that blur event doesn't occur when you submit by hitting Enter. So my solution is:

function focus() {
	this.GM_name = this.name;
	this.name = '';
}

function blur() {
	this.setAttribute('name', this.GM_name);
}

for (var inputs = document.getElementsByTagName('input'), x, i = 0; x = inputs[i++];) {
	if (x.type == 'text') x.addEventListener('focus', focus, false), x.addEventListener('change', blur, true);
}