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

Site block extension

6 views
Skip to first unread message

bobscape

unread,
Oct 31, 2006, 10:10:34 AM10/31/06
to
I bascially want to build an extension that does 3 simple things. (at
least I think they should be simle)

1. Check the URL in the address bar against a list (on local machine)
2. If on list redirct to given site.
3. Allow for update of the list from a central server.

Sounds simple, but i don't really know where to start.
I am new to extension development (I have done Hello World in status
bar) *smile*

Can somebody point me in the right direction.

Thanks

Eric H. Jung

unread,
Oct 31, 2006, 2:02:57 PM10/31/06
to bobscape, dev-ext...@lists.mozilla.org

1. Get URL in address bar with document.location
2. There are many ways to do this, but assuming you have your list of addresses in an array:

if (myURLArray.some(function(e, i, a) {return document.location.indexOf(e)>-1;})) {
// redirect
document.location = "http://my.new.location.com";
}

You might consider using a regular expression match instead of indexOf().

3. Use XmlHttpRequest() to retrieve the file, then XMLSerializer.serializeToStream() to write to disk.

Thanks

_______________________________________________
dev-extensions mailing list
dev-ext...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-extensions

0 new messages