Helpful Information
 
 
Category: Ajax and Design
Firefox extension: click link

Hi all, quick question.

I'm rather new to coding an such so I can't figure out on how I would go about making this plugin. I've googled till I had dead pixels on my screen, but to no avail - so I figured I'd ask it in a place where they'd probably know.

What I'm -trying- to make is a firefox plugin that automatically clicks a specific link when the browser is pointed to a specific page.

Example:

I'm on site.com/bunnies.php?name=randomstring&B=randomstring

On that page are 2 more links.

° Kick the bunny.

site.com/bunnies.php?name=randomstring&animal=&B=randomstring
° Leave the bunny alone.

site.com

The random strings gets changed every few minutes, so I would need to use a wildcard.. but I can't figure it out.

Is there any way to have the browser click links named "Kick the bunny" automatically?

Thanks in advance

note: the bunnies are just an example lol :D

I don't know any way to get the browser to do that automatically without it being your page and running javascript on it that does what you need (altering the link).



for (int i = 0; i < document.links.length; i++) {
if (isABunnyLink(document.links[i].src)) {
kickTheBunnyLink(document.links[i].src);
}
}


Something like that. Obviously you'd have to write the two bunny functions based on your needs.

As for the extension, I've never written one but there are tons of tutorials. Just search for "firefox extension tutorial" on google. Plus you can go to the mozilla page about extensions that has lots of info.

http://developer.mozilla.org/en/docs/Extensions

david_kw

Extensions are basically little tools that do stuff for you, like adding more options to your right click menu, auto fill forms etc. They mainly consist of java, some ajax for the advanced features and very rarely C++.

I'm trying to make one that clicks links I want it to click as I would with my mouse, but automatically so I don't need to click or move my mouse.

I know it is possible, so I'm not trying to reinvent the wheel. Just don't know on how I would go about doing it as honestly, the only coding I am able to do is XHTML/CSS/TPL and a little bit of PHP.

Your example does clarify some for me, but I don't see how I could use it. Honestly 0.0% knowledge of java.

What I basically want my extension to do is;
if on site.com/bunnies.php?name=*&B=* > look for 'attack the bunny' >
if found > kick bunny.
if missing > return to bunnies.php

Ah, I see. Well extensions are something I've thought about looking into but have yet to find the time/motivation. I wish you luck.

david_kw

What I'm -trying- to make is a firefox plugin that automatically clicks a specific link when the browser is pointed to a specific page.



if i understood you, you want that, when you go to a page, you're redirected to another one taking the link from the page in which you are.

and you want to do it as a FF extension.

so i suggest you to:
1-read this tutorial about XUL (http://www.xulplanet.com/tutorials/xultu/), the language used by FF extensions.

XUL was designed for creating the user interface of the Mozilla application including the web browser, mail client and page editor. XUL may be used to create these types of applications. However, it may also be used any place you would currently use a web application, for instance, when you need to be able to retrieve resources from the network and require a sophisticated user interface. Like HTML, in XUL you can create an interface using a markup language, use CSS style sheets to define appearance and use JavaScript for behavior.

2-use javascript to read the url you want to redirect to and doing it.

it's quite easy to create an extension for FF, but only if you have any knowledge about DOM and JS...










privacy (GDPR)