Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Manipulate website content (replace URLs)

2 views
Skip to first unread message

ajun...@gmail.com

unread,
Jan 22, 2012, 2:40:43 PM1/22/12
to
Hello,

I have programmed a firefox extension by myself for my private usage
for 5 minutes. I have never programmed a firefox extension before but
I hope you can help me.

I'm reading the documentation about "Building an extension", so I'm
searchin' for a documentation who contains how I manipulate the
content of webpages.

My idea is to replace some parameters of URLs in the source code
(HTML). Don't shout at me. This extension is just for me to redirect
to the webpage which is given as parameter. But the most webpages show
a warning page before they redirect to the actual website.

Do you understand me although my bad English? :D

Example:
original
http://example.org/sub?var=http://example.org
My extension should replace/cut this "string" directly to http://example.org

ajun...@gmail.com

unread,
Jan 22, 2012, 2:42:05 PM1/22/12
to
On 22 Jan., 20:40, ajunki...@gmail.com wrote:
> Hello,
>
> I have programmed a firefox extension by myself for my private usage
> for 5 minutes. I have never programmed a firefox extension before but
> I hope you can help me.
>
> I'm reading the documentation about "Building an extension", so I'm
> searchin' for a documentation who contains how I manipulate the
> content of webpages.
>
> My idea is to replace some parameters of URLs in the source code
> (HTML). Don't shout at me. This extension is just for me to redirect
> to the webpage which is given as parameter. But the most webpages show
> a warning page before they redirect to the actual website.
>
> Do you understand me although my bad English? :D
>
> Example:
> originalhttp://example.org/sub?var=http://example.org
> My extension should replace/cut this "string" directly tohttp://example.org

You can also answer in German. :D

Archaeopteryx

unread,
Jan 26, 2012, 1:50:18 PM1/26/12
to
Hi,

I don't answer in German because documentation gets written in English
and only if it is popular enough into German.

As you want to manipulate a web page, you can easily try it using the
Scratchpad (Tools > Web developer > Scratchpad or Extras >
Web-Entwickler > Notizblock).

There type something like this:

var links =
document.querySelectorAll("a[href^='http://www.startdomain.org/']");

This would return an array of all links on the page which start with
http://www.startdomain.org. For more documentation see
http://www.w3.org/TR/css3-selectors/ You can also just do "a[href]" to
get all links. But the more links, the slower your script.

Now you can run a 'for' loop through your array, check the value of the
href attribute and replace it with whatever you want.

(Unfortunately, most code examples at https://developer.mozilla.org are
currently invisible.)

Archaeopteryx

-------- Original-Nachricht --------
Betreff: Manipulate website content (replace URLs)
Von: ajun...@gmail.com
An:
Datum: 2012-01-22 20:40
0 new messages