Source code - addons.mozilla.org page
This was done as a request for someone on the Mozillazine forums.
The extension allows you to specify patterns for pages that should be automatically redirected to other pages. E.g. you always want http://example.com/foo.html to redirect to http://example.com/bar.html.
This can be useful for instance to skip confirmation pages after posting messages on message boards, skipping ad pages that appear before you can view content on certain sites, redirecting from http to https on sites where you always want the https version, redirecting from one hostname to another for proxy servers, or just anywhere where it takes you two or more clicks to get to what you want.
The extension supports both wildcards and regular expressions in patterns. Regular expressions support capturing parantheses so you could define the pattern: http://foo.com/bar.php\?id=(\d+) and define the redirect as http://bar.com/baz.php?id=$1. In that case http://foo.com/bar.php?id=1234 would automatically redirect to http://bar.com/baz.php?id=1234. As of version 1.5 wildcards can also use $1,$2 in the redirect urls, $1 is the contents of the first star match, $2 of the second and so on.
To add a new redirect, right click either anywhere on a page and click ‘Add current url to Redirector’ or right click on a link and click ‘Add link url to Redirector’. You can also add urls from Tools->Redirector->Add… but then you won’t get the example url filled in.
To edit and delete redirects, goto Tools->Redirector, or choose Options on the Addons window.
To disable Redirector temporarily, click on the R that’s in your statusbar. Right clicking the icon opens the Redirector options window.
Deprecated features:
- XPath expressions for redirect urls: No longer supported as of version 1.5.1
- “Only if link exists” option: No longer supported as of version 1.7.
- Special handling for POST requests: No longer supported as of version 1.7. Newer versions simply won’t work on POST requests.
Works with Firefox 3.0 – 3.5.*
Latest version: 1.7.1
Download
Version 1.7.1 — May 30, 2009
Two tiny bugfixes from version 1.7.
- An error message was printed to the Error Console ‘Redirector.unLoad() is not a function’ when the Options dialog was closed.
- For new users, the first time the options dialog was opened, it contained one item where everything was marked as ‘undefined’.
Version 1.7 — May 29, 2009
This version updates Redirector to support Firefox 3.5, while dropping support for the 2.0.* series. The version does not add any new user features. Instead it is a technical update, with a lot of the core functionality re-written to pave the way for the upcoming 2.0 release which will contain many new features. As of this release the “only if link exists” option is no longer available and redirects on POST requests will no longer work. This is a side effect of the new implementation, since I have not heard from a single user that uses these features I decided that it was ok to remove them. Contact me if that is a problem for you.
Although not really “user features”, here is a list of the technical changes for those interested:
- Redirector is now an implementation of the nsIContentPolicy interface. Before there were different ways used to catch requests depending on whether it was opened in a new tab, new window, came from the outside etc. This new implementation works fully for any case and makes the code a lot cleaner and maintainable. It also makes sure that the requests to the original url are never made, they are blocked before they leave the browser which was not always the case in the old version.
- The format of the redirects is no longer JSON, and is not eval’d to import. This was taken out for security reasons, since v2.0 will support importing redirects from others, and it is not safe to eval something from the outside.
- The Redirector class itself is now a javascript XPCOM component, which makes it a true global object, whereas before there were multiple instances which communicated through preferences and preference listeners (a big hack basically).
Version 1.6 — May 24, 2008
Compatible with Firefox 3.0.*.
Version 1.5.2 — January 28, 2008
This version pretty much adds all features and fixes that people have been asking for, that’s why I bumped the version all the way up to 1.5.1. Here’s what’s new:
- Firefox 3 compatibility
- Improved UI in the Redirector settings window
- Access Redirector settings through the statusbar icon. Left click disables Redirector, right click shows settings.
- Ability to hide context menu and status bar through about:config, just search for redirector and you’ll find the config options.
- Replacement chars ($1,$2…) for wildcards as well as regular expressions.
- Help file included with examples, accessible through the Redirector settings window.
- Possible to add exclude patterns in addition to the normal include patterns, this makes capturing certain things simpler.
- And last but not least, redirects now work when opening new windows, new tabs, middle clicking links, opening bookmarks and opening urls from other applications.
One feature was removed in this version, that is the xpath redirect urls. The reason is that as far as I know no one was using the feature and it was causing some problems so I decided to remove it. I think this addon is pretty much feature complete at this point, I don’t think I’ll work more on it except to fix bugs from now on. Enjoy
Version 1.5.1 — January 23, 2008
This version was what is now 1.5.2. It was rejected at AMO, so I changed it and released as 1.5.2. Version 1.5.1 was available on this site in the meantime.
Version 1.5 — January 8, 2008
This version was what is now 1.5.2. It was rejected at AMO, so I changed it and released as 1.5.1. Version 1.5 was available on this site in the meantime.
Version 1.0.2.1 — October 5, 2007
Bugfix release. Two bugs:
1. Fix missing statusbar icon on linux
2. Fix error that came in the error console when Redirector was disabled
Version 1.0.1 — October 2, 2007
Bugfix release. Two bugs fixed:
1. The stop button was always active and it looked like pages never finished loading.
2. There were some memory leaks when opening and closing new windows.
Version 1.0 — September 28, 2007
Three new features in this version:
1. Instant redirects instead of loading the page before redirecting.
2. XPath expressions to specify redirect urls.
3. Redirect url can now be a relative url and will then be resolved against the first url.
Details about these features have been included in the main extension description.
Version 0.9.2 — August 7, 2007
This version adds an ‘Add…’ button to the main Redirector window (Tools -> Redirector) so you can enter urls and patterns directly from there. If you do it there you of course won’t get the example url filled in automatically.
Version 0.9.1 — June 2, 2007
All functionality working. Not yet 1.0 because I have to fix some minor UI things (i.e. make it not be butt-ugly) and some other minor things.
Hey, just saying thanks for making this.
Loving it =)
This add-on is nice to have, but I still can not figure out how to use regular expressions with it, even if I enter everything as explained here on the page.
I use firefox 2.0.3.
I tryed using the following urls
index.php%3Fref%3D357.51162346
index.php%3Fref%3D357.(\d+)
index.php%3Fref%3D357.$1
Hi Dave
The problem you have is because the redirect url is a relative url, not an absolute url. The extension uses simple javascript redirection, i.e. it redirects to the new page after the old one has loaded but before it is rendered, and javascript document.location = ‘index.php’ doesn’t seem to work. Try this:
and then try going to http://tech.einaregilsson.com/index.php%3Fref%3D357.51162346 and see if you aren’t redirected. I probably should have mentioned in the documentation that the redirect url must be absolute. You probably should have the pattern absolute too, but that’s up to you, the pattern will work either way, it’s just the redirect url that must be absolute.
Hope this helps,
-einar
I don’t know how to use regular expressions, so please help me with this,
I want to add &comments=all to the end of all “http://www.haber7.com/haber.php?haber_id=267167″-like addresses. As you could guess the decimal number right after “id=” can take any value.
For example, I want to convert,
“http://www.haber7.com/haber.php?haber_id=123456″
to
“http://www.haber7.com/haber.php?haber_id=123456&comments=all”
How can I do that?
Hi
Try these:
Example url: http://www.haber7.com/haber.php?haber_id=123456
Pattern: http://www.haber7.com/haber.php\?haber_id=(\d+)$
Redirect to: http://www.haber7.com/haber.php?haber_id=$1&comments=all
That should work for you. And of course remember to select ‘Regular Expression’ instead of ‘Wildcard’.
Small breakdown of the regex in case you’re interested:
1. The \? instead of just ? is because ? is a special character in regex and by using the escape character \ we say ‘Match an actual ? sign’.
2. (\d+) The brackets () mean to capture what’s inside them so you can use it in the replacements (where it’s defined as $1 or the first capture). The \d means a digit, and + means a digit one or more times.
3. $ means end-of-string. This is because otherwise the pattern would also match http://www.haber7.com/haber.php?haber_id=123456&comments=all and would constantly try to redirect again. So we say ‘the url must end after the digits’.
Hope this helps.
-einar
Would it be possible to get Firefox to preload a page in the Forward History instead of redirecting? There are several sites, where upon visiting a page, I nearly always click a certain link after reading the content, or type in a specific URL based on the content.
For example, on http://boingboing.net/ posts, I like to read the content posted by the BoingBoing contributor, and then click on the link to the page they are referencing - usually it is labeled “Link”. It would be useful if Firefox automatically loaded “Link” as the next page in my forward history as soon as I visit a page like:
url: http://www.boingboing.net/2007/09/19/skull-font-free-from.html
regex: http://www.boingboing.net/\d+/\d+/\d+/
so now have Firefox preload the link found at XPath: /html/body/div[@id='wrap']/div/div/div[2]/div/p/a
Another idea, could be to select some text via XPath and then pass it on to a Firefox bookmark that has a keyword. For example, after reading about a movie like “The Matrix” on imdb.com, I often go to the URL toolbar and type in:
imp “the matrix”
which I have bookmarked as a keyword for:
http://www.google.com/custom?domains=www.impawards.com&q=%s&sitesearch=www.impawards.com
I’m then redirected to a search on the Internet Movie Poster Awards site which usually has movie poster images of the largest size.
Just a few ideas.
Those would all be possible but I’m not sure I wanna take it in that direction. (By that I mean that I’m way too lazy to implement it
). But those are good ideas and might be worthy of their own extension. But I’m pretty sure there are some pre-fetch extensions out there that might be modified to include this functionality.
Don’t be lazy
, this extension can be one of the best and useful one if you solve this redirection problem.
Me too think that it would be best if it opened only the page to be redirected, instead of first loading the original page and then redirection to another.
Anyway, i like this extension, good work!
Well hkBattousai, you’re in luck. Version 1.0 which I just released adds instant redirects.
And Jeff, while I didn’t do the pre-fetching thing I liked the xpath idea. So in v1.0 you can create the redirect url from an xpath expression
You’ve added XPath expressions?! Sweet! Thanks einar.
Hey there,
Thanks a lot for the time and effort dedicated to the extension. I’m really sorry, but I can’t figure what I’m doing wrong:
I would like to use the string “950305″ to be redirected from
http://www.lanacion.com.ar/informaciongeneral/nota.asp?nota_id=950305&pid=3297495&toi=5234
to
http://www.lanacion.com.ar/herramientas/printfriendly/printfriendly.asp?origen=3ra¬a_id=950305
And this should also work in other sections of the same website. For example:
I would like use the string “950398″ to be redirected from
http://www.lanacion.com.ar/weblogs/rugby/nota.asp?nota_id=950398
to
http://www.lanacion.com.ar/herramientas/printfriendly/printfriendly.asp?origen=3ra¬a_id=950398
So… could you please give me a hand?
Thanks,
Leo
Hi. For this you’d have to use a regular expression match, to be able to capture the number defined by nota_id= and use it in the redirect url. For your first example you should be able to do this:
example url: http://www.lanacion.com.ar/informaciongeneral/nota.asp?nota_id=950305&pid=3297495&toi=5234
pattern: http://www.lanacion.com.ar/informaciongeneral/nota.asp\?nota_id=(\d+)&pid=\d+&toi=\d+
redirect to: http://www.lanacion.com.ar/herramientas/printfriendly/printfriendly.asp?origen=3ra¬a_id=$1
Remember to check the ‘Regular Expression’ box.
For the second one you should be able to do this:
example url: http://www.lanacion.com.ar/weblogs/rugby/nota.asp?nota_id=950398
pattern: http://www.lanacion.com.ar/weblogs/rugby/nota.asp\?nota_id=(\d+)
redirect to: http://www.lanacion.com.ar/herramientas/printfriendly/printfriendly.asp?origen=3ra¬a_id=$1
Remember to check the ‘Regular Expression’ box.
Now, note that if they are sometimes different, e.g. sometimes there an additional parameter &x=y in the url or something like that, then this will not work for all cases. But you said you wanted to use it on other section to. For the general case where you want ALL urls that end in nota.asp? and have a nota_id parameter to redirect to the printfreindly url, you could do something like this:
pattern: http://www.lanacion.com.ar/.*?/nota\.asp\?.*?nota_id=(\d+)
redirect to: http://www.lanacion.com.ar/herramientas/printfriendly/printfriendly.asp?origen=3ra¬a_id=$1
This should work on both the example urls you provided.
Let me know if you have any additional questions.
Wow, that was a quick response. Brilliant, it works perfectly. I really really appreciate it. Additional questions? Yes, two more annoying ones:
1) It seems that when the add-on is enabled (within Firefox’s add-ons menu, not the Redirector’s bottom right “R” switch), for some reason Firefox keeps displaying the “Waiting for” message at the bottom left, as well as the loading progress bar on the right. This occurs in any webpage, regardless of whether Redirector is working on it or not.
2) Do you think you’ll be able to make the add-on work as well when the link to be redirected is opened in a new tab?
Anyway, they’re just a couple of observations, no complaints from my part whatsoever, I’m very grateful for your work. Thanks again!
Leo
1) The ‘Waiting for’ stuff is a bug that I already got a bug report for. I fixed it in Redirector 1.0.1 but it’s being held for review at addons.mozilla.org because there was some problem with the icon in Linux or something. However, you can get 1.0.1 on this page, at the top after the extension description there is a download link for 1.0.1. I haven’t had time to fix the icon Linux stuff so it might be a few days till you can get it at addons.mozilla.org.
2) That *should* work! (Famous last words…). But I haven’t tested it especially, might be something that keeps it from working when opening in a new tab. I’ll look into it for the next release.
I think there’s an error in the new version.
It started to give this error :
http://img172.imageshack.us/img172/8408/errorud6.jpg
It shouldn’t do recursion for that string. The regular expression is “…(/d+)”. And my URL is “…(/d+)&comments=all”. They don’t match, do they?
…(/d+) matches …(/d+)&commets=all because ending with (/d+) doesn’t say that it has to be the end of the string. Just like ‘mike’ would match ‘mikelle’. So, add $ to the end of your pattern and then you’re saying it will only match something that ends with (\d+)
Hi,
Some suggestions:
1- Redirector only works when use left click on the link (to open the web site) or using “Duplicate tab” menu. It doesn’t work when I use the right-click “Open Link in new tab” or if I use the middle click to open the link in a new tab.
2- It could be nice to have access to the Redirector Settings panel from the icon in the status bar and not only from the Tools menu.
3- It could be nice too to have an option to choose if we want to see or not “Add current url in Redirector” in the context menu.
Thanks
Hello again…
I can’t figure how to introduce directories as the variable.
I would like to be redirected from:
http://www.macworld.com/2007/10/secrets/tcoleopardupgrade/index.php?lsrc=mwrss
to:
http://www.macworld.com/2007/10/secrets/tcoleopardupgrade/index.php?pf=1
Help please…?
Thanks
@Peuj: Thanks for the suggestions. I’ve alread gotten some complaints about the right click thing, that’ll definitely be in the next version. I’ll probably also add the settings menu from the statusbar icon. As for disabling the context menu item, I might add it as a preference you can set in about:config, I doubt I’d bother to do a preferences dialog unless I start coming up with some new prefs. I’m not sure when the next release will be however, maybe in a few days or weeks.
@Leo: I’m not sure what you mean. I’m guessing you want all the index.php?lsrc=mwrss to be index.php?pf=1 instead. But I don’t know which of the directories are variables. Obviously 2007 and 10 are, but what about secrets and tcoleopardupgrade? Is that the name of this particular article, or category or what? The quick and dirty way to do this would be to say something like:
Pattern: http://(www.)?macworld.com/(.*)/index.php\?lsrc=mwrss
Redirect url: http://www.macworld.com/$2/index.php?pf=1
Which just means that any url on macworld.com (with or without a leading http://www.) that ends in index.php?lsrc=mwrss will redirect to the same url, but with ?pf=1 instead.
Fast redirects don’t seem to be working from the address bar, or from a live bookmark, for me.
My pattern is
http:\/\/www\.anandtech\.com/?\w*\/showdoc\.aspx\?i=(\d*)
to redirect to
http://www.anandtech.com/printarticle.aspx?i=$1
“regular expression” is selected, “only if link exists” not selected, but I see the page load before the redirect occurs if I navigate to, e.g. http://www.anandtech.com/cpuchipsets/showdoc.aspx?i=3134 from a live bookmark or pasting straight into the address bar. If I follow a link from the homepage, however, I do get a fast redirect.
Still, it’s faster than clicking a bookmarklet to get where I want to, so many thanks for the extension!
jon
Hi Jon
There are some cases where fast redirects don’t work and some cases where redirects apparently don’t work at all, like middle clicking a link or right clicking and choosing ‘open in new window’. The plan for the next version is to try to fix all the edge cases, but I haven’t even started working on it yet, it won’t be out for at least a few weeks.
-einar
Very useful extension, thank you….
…but does not work reliable, making it useless
(The redirected tab needs to have focus, otherwise Redirector ignores the matching URL).
Waiting hopefully, maybe you’ll find the time to fix this extension.
Hi,
Very useful extension, thank you….
but i have problem, I need that the redirect will suspended because i want
the original page will be load and i will see the page for 3 or 4 seconds.
can it possible?
Hi,
I try to redirect my links:
For instance from:
http://www.jneurosci.org/cgi/content/short/27/51/14049
To
http://www.jneurosci.org.gate2.inist.fr/cgi/content/short/27/51/14049
In a more generic way that would be to redirect anything from
http://www.jneurosci.org
to
http://www.jneurosci.org.gate2.inist.fr
Could you help me?
Hi Olivier. Try this:
Set pattern type as Regular expression
Pattern: http://www.jneurosci\.org(.*)
Redirect to: http://jneurosci.org.gate2.inist.fr$1
Let me know if that doesn’t work, then I’ll figure out a pattern that definitely works. I just don’t have time to test it right now
p.s., you could even allow to redirect from urls without www in front by doing:
Pattern: http://(www.)?jneurosci\.org(.*)
Redirect to: http://jneurosci.org.gate2.inist.fr$
Thanks Einar for your fast reply!
Your code didn’t work as you wrote, but it allowed me, turning around, to find the proper syntax:
Pattern:
http://www.jneurosci.org/cgi\/(.*)
Redirect to:
http://gate2.inist.fr/login?url=http://www.jneurosci.org.gate2.inist.fr/cgi/$1
Is there / will be a possibility to save the settings for backup or sharing ?
My collegues will be very happy with this excellent addon!
I don’t really understand why you want to redirect all your pages to the login page. Couldn’t you just as well have the redirect to:
http://www.jneurosci.org.gate2.inist.fr/cgi/$1
Anyway, about importing/exporting settings, yours is the first request I’ve gotten for that, so it’s not really on the drawing board yet. However it is a good idea and so might be implemented at some point in the future. For now you can goto about:config in your browser window, type ‘redirector’ in the filter window and then you should see the key: extensions.redirector.redirects
The value from that are all your redirects, so you should be able to just copy that string and paste it into the same key in another instance of firefox.
Just come here to say thanks to you for such a cool add-on! And Merry Christmas:)
Hi Einar,
I am using your add-on, but I found there is a minor weird thing.
If I click the link which will cause a new tab(e.g ‘open in a new tab’ or use some tab add-on like Tab Mix, and in fact most web sites open their links in new pages by default in China :)…. ), the redirector sometimes can’t work.
Hope you can check this after your back from holiday:)Thanks!
Hi, I’m trying to redirect this:
http://meudominio.com/*/
where * means any page possible
to:
http://meudominio.com/*/ok
but this ‘*’ must be the same of the other one. Can I do that?
Eg:
http://meudominio.com/alo/ to http://meudominio.com/alo/ok
http://meudominio.com/bomdia/ to http://meudominio.com/bomdia/ok
I need a single rule to do that.
Thank you!!!
Ok, i did it. Thank u anyway!
Until Einar has time to add the preference to remove the context menu item, you can hide it (and/or the statusbar icon which I also prefer not to have) by adding the following line(s) to your userChrome.css file:
#redirector-context{display:none !important;} /* hide redirector context menu items */
#redirector-status{display:none !important;} /* hide redirector statusbar icon */
Hi Jon
You’ll be happy to know that I’ve added about:config entries for both those things in the latest version which should be out in a few days, a couple of weeks at most.
Other planned changes:
* Redirects work when opening new windows, tabs, from bookmarks, etc.
* Possible to specify “Exclude patterns” to simplify some patterns that were hard to express with a single regex.
* Better UI for the redirects window.
* Help file with some common examples of redirects.
* Menu available from the statusbar icon.
Basically I put in almost every suggestion I’ve gotten in the last few months. It should be out pretty soon.
Einar,Happy new year! And happy to heard your great changes in plan:)
I have found a great use for Redirector for those of us who like OpenDNS and HATE the search they put us on instead of doing an im feeling lucky on google.
Example URL: http://guide.opendns.com/?url=zomg
Pattern: http://guide.opendns.com/\?url=(\w+)
Redirect to: http://google.com/search?btnI=1&q=$1
Using Regular Expressions
It is a little slower than it would be normally but well worth it in my opinion try it out!
Small bug report, The redirector only works in the active window. If a page page is redirected in a tab you are not viewing the rules are not applied -kaet
Version 1.5 is now out which fixes all the known bugs and adds some new features. It’s currently in the sandbox at AMO but you can get it here on this page and read the release notes to see what’s new.
Cool~
Thanks !!
Thank you !!
http://netcat.ath.cx/extensions.html
Hi Einar,
I’m not sure whether this is a bug report or a feature request, but Redirector doesn’t seem to work with images loaded as part of another page. It *does* work if the images are loaded directly.
For instance, if you have a rule that redirects http://serv1.example.com/* to http://serv2.example.com/$1 (ie, anything on that host), and you visit http://www.example.com/, which loads http://serv1.example.com/foo.jpg in an IMG tag, the request is not redirected: the image loads from serv1 anyway. If you load the image directly (eg, by right-clicking on it and selecting “View Image”), the request is redirected successfully and the image loads from serv2 as expected.
I’d expected this to be the same sort of problem that affected redirections in new tabs and so on, but I see that’s been fixed; it would be really nice if this case could be fixed too. Thanks!
Hi Einar,
(apologies if this is a duplicate post; my posts seem to be getting lost.)
I’m not sure whether this is a bug report or a feature request, but Redirector doesn’t seem to work with images loaded as part of another page. It *does* work if the images are loaded directly.
For instance, if you have a rule that redirects http://serv1.example.com/* to http://serv2.example.com/$1 (ie, anything on that host), and you visit http://www.example.com/, which loads http://serv1.example.com/foo.jpg in an IMG tag, the request is not redirected: the image loads from serv1 anyway. If you load the image directly (eg, by right-clicking on it and selecting “View Image”), the request is redirected successfully and the image loads from serv2 as expected.
I’d expected this to be the same sort of problem that affected redirections in new tabs and so on, but I see that’s been fixed; it would be really nice if this case could be fixed too. Thanks!
Hi Tarquin.
Your posts are not getting lost, it’s just that any comment with more than one url in it needs to be approved to reduce spam. Spam comments usually have 10-20 links in them.
About your question, Redirector doesn’t support image redirecting, it will only redirect pages. You are the first person ever to request this, I might look at it in a future release but it won’t be anytime soon, sorry.
any chance you could make this also affect urls manually entered in the urlbar?
@DeathWolf: That should work. Can you give me an example of a pattern and url where it doesn’t work for you? And your Redirector version and Firefox version?
redirecting something like ‘^(site:.*)’ to ‘http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=$1′ (to avoid firefox’s stupid failure in case of non-recognized protocol)
Ah, now I see. That doesn’t work because I only get notified of a change in url when it’s changing to a known protocol. The error message you get is produced before I get a change to rewrite the url, so it won’t work. To change it I’d have to capture some event that occurs even sooner then the location change thing. I might look at it in a future version, but right now I’m unfortunately way too busy to work on this extension
No problem:) I have so far been using a modified URLFix(another extension) to do it, so I was just asking to see if you had time for it:)
Thanks for this addon!
I used this to direct mail.google.com/mail to mail.google.com/mail/h (basic html mode).
Now whenever I check my email I get to do it in basic html mode instead of the bulky javascript-intensive classic view.
Here are the lines I used should anyone else out there want to use this addon to make Basic HTML view in google mail your default mail view upon a regular gmail login via mail.google.com!
Include: mail.google.com/mail(.*)
Exclude: mail.google.com/mail/h(.*)
Redirect: https://mail.google.com/mail/h/
I hope this helps someone!
Hi all.. i kinda new using this extension.. is it possible to redirect from a post function..?? if can, can sumone show me how..?
another thing i kinda bored ticking some of the radio buttons also.. is it possible to use redirector when a page loads, we can set which radio button to check.. if can not can someone make add-ons like that also.. hehe.. i know u guys are damn good with progamming.. hope u can teach me sum..
Thx
Hi Nadia. Sorry, redirecting from post is not possible. The availability to set form values before redirecting is interesting but I doubt it will get into the extension any time soon since I don’t have much time to work on it.
A request for when you next get time to work on this extension - an option to send the original URL as referrer to the new URL. It seems that some sites display their home page rather than the page requested, if you haven’t first been to the original URL.
Hi
I want to use Redirector like that: I go to Google Reader and check my Feeds. Those Feeds which are interesting I open in a new tab. But I want to go straight to the Printversion of the Page.
But the problem is that the redirector doesnt work for the tabs which are opened in the background.
Do you have any advice how I can do that?
Tnak you
Thanks for making RC1 compatible.
Nice extension, I would just like to see an import/export-function.
@Pumie: For me it works to open a tab in the background. Can you describe a specific case where it does not work? Do you ctrl+click? Do you right click and choose ‘open in new tab’? And some urls that it doesn’t work for would be good so I can verify the bug. Thanks.
Hi Einar,
This is a wonderful extension - I use it all the time for use with my University’s EZProxy (where a suffix has to be appended to all URLs).
The one thing I would love to see implemented is a per-tab activation setting. That is - I would like to be able to activate redirector for one tab, but not another (so when i switch tabs, the “R” in the status bar remembers enabled/disabled states for those tabs). In my case, this is because I want to use my proxy in some instances while doing research, but not in others (checking email, etc - slower though the proxy, and it also gives 404s for all non-academic-related sites).
Thanks!
Allie
Hi allie
Glad you like the extension. I doubt that I will add per-tab activation, this is the first request I’ve gotten for it. The obvious solution is to have one browser instance with Redirector enabled and another where its not. (I think, I don’t actually remember exactly how I did the enabled/disabled logic).
But I’m curious about what you say about “also gives 404s for all non-academic related content”. Is there no pattern in the academic sites that you can use so redirector only applies to them? You could also add an exclude pattern for your email site etc. Let me know if you need some help with patterns or regular expressions for them.
Hi einar,
I want to setup the URLS using command line or external application. Is this possible?
Thanks
Assc
This does not work for me. I tried to use it but found it loaded the
entire webpage and then redirected to the specified URL. It did not
work if ‘Only if link exists’ was checked or not. It always loads
the entire webpage and then redirects. I am using a dialup modem
if that makes any difference.
As an alternative, could you make a ‘go to instead of’ option?
I would like to see it completely block the original URL and
immediately go to the specfied url, even if there is a post or get
or anything else.
Hi John
Can you give me specific examples of webpages / patterns that do not redirect you immediately? And version numbers of Firefox and Redirector that you are using?
Post requests don’t do fast redirects by design, and that is not likely to change in the near future.
About Redirect to other web address // html code —
http://html-lesson.blogspot.com/2008/06/redirect-to-web-addres.html
Hi,
I’m trying to figure out how to redirect all connects to The Pirate Bay to the SSL version of the site, but I can’t figure out the regex. Does this look right to you:
http://\([A-Za-z0-9-]\.\)*thepiratebay\.org\([A-Za-z0-9-]\)*
I don’t know what the rules of your regex parser are….
Sorry, a small change: http://\([A-Za-z0-9-]\.\)*thepiratebay\.org\(/[A-Za-z0-9-]\)*
Trying out your example I found an error in Redirector. The problem was that if a group had an empty match the replacement string would get an ‘undefined’ string added in place of $1. Anyway, for now I recommend you set up two redirector rules, these two should work:
Include pattern: http://thepiratebay.org(/.*)
Redirect to: https://thepiratebay.org$1
Include pattern: http://(\w+\)\.thepiratebay.org(/.*)
Redirect to: https://$1.thepiratebay.org$2
Thanks for the help!
FYI, for the second one, I had to change it to http://(\w+)\.thepiratebay.org(/.*) . I’m running Firefox 2.0.0.14 with Redirector 1.6, so maybe that’s because I don’t have Firefox 3 yet (haven’t upgraded to Kubuntu Hardy yet ;/).
The wildcard type with multiple placeholders seems to fail sometimes:
Example url: http://www.handelsblatt.com/unternehmen/industrie/airbus-will-produktion-massiv-steigern;2010995
Include pattern: http://www.handelsblatt.com/*/*/*;*
Redirect: http://www.handelsblatt.com/$1/_b=$4,_p=5,_t=ftprint,doc_page=0;printpage doesn’t match.
Great plugin. Thank you very much. Just works. Add a homepage to the help text.
the redirect url that must be absolute…
does that mean I cannot just replace
http://195.161.116.13/ for http://ljplus.ru/
in links like
http://195.161.116.13/img4/o/r/ormand/NLO.jpg
where I never know for sure what comes after the IP?
well, I think I got it.
that must be
http://195.161.116.13/*
and
http://ljplus.ru/$1
I should have seen an example like this in the description…
but, then, it seems, someone else asked that already:
can I prevent loading the “include pattern”-site and force loading the new url?
that means if I have a site with embedded IP-url images I still have to ctrl+click them to open in a new tab, which then replaces the IP for the url I need. but no images are shown in the original post, since those nasty invalid IP-urls are not replaced with correct ones before I open each one separately…
oh, the dollar symbol in previous comment is gone…
Very helpful extension, thanks
But in the ‘redirect to pattern type’ is the ‘$’ the ONLY character that acceptable?
Example.. lets say I wanted to redirect to:
http://www.*.abc.com/$1
Now, why the star doesnt work, but only $?
Can you updated it? thanks in advanced..
Hi
Sorry Mark, I’m not sure I understand what you want to do. If you have something like:
Pattern: http://*.abc.com/*
Redirect to: http://$1.def.com/$2
And visit http://www.abc.com/hello
you will go to http://www.def.com/hello
Why would you want to put the * into the redirect to pattern? What are you trying to achieve?
Hi einar.. thanks for the reply..
Okay.. heres the real samples:
I like webshot, and what I wanted to do is click the thumbnail and directly go to the full sized images..
The thumbnail link:
http://home-and-garden.webshots.com/photo/2955899740048346219DiUxtz
The fullsized link:
http://image58.webshots.com/758/8/99/74/2955899740048346219DiUxtz_fs.jpg
Now, you notice that image58,758,8,99,74 are all DYNAMIC link.. so what I wanted is, whenever I click thumbnail in webshot (http://*.webshots.com/photo/*) it automatically be redirect to :
http://image(dynamic).webshot.com/(dynamic)/(dynamic)/(dynamic)/(dynamic)/$1_fs.jpg
I hope you understand what I mean.. thanks
Sorry if I’m not so clear..
What I mean is.. what if in the redirect page contains a dynamic url?
From your example:
http://www.def.com/123/hello.jpg (I changed a bit)
Now, 123 is dynamic here.. so if I click http://*.abc.com/*.jpg is not always go to http://www.def.com/123/hello.jpg but could be http://www.def.com/457/hello.jpg or http://www.def.com/789/hello.jpg (depends on the server which store the image)
So I think it would be cool if in redirect page can be add like this:
http://www.def.com/*/$1
Sorry if Im not so clear.. here real example:
http://outdoors.webshots.com/photo/1088478069039217872LnaWAA
and I want straight to the full size image that located here:
http://image07.webshots.com/7/7/80/69/88478069LnaWAA_fs.jpg
You see image07;/7/;/7/;/80/;/69/;10(88478069)LnaWAA_fs.jpg are ALL dynamic link here.. except for 88478069..
That’s why I need to put * in the redirected to page.. I hope you understand what I mean.. or perhaps you had a better idea what should I do with this link..
Thank you very much..
Hi, I read through the comments & tried to understand the patterns & examples so that I didn’t have to post a question…But it’s not working for me. I think it’s because it’s late & I am sleepy…So brain no worky right now. I’m sure my redirect is simple though.
I want all YouTube links to have “&fmt=18″ added to the end of the link. Example:
http://www.youtube.com/watch?v=D1j823QH6cU
becomes
http://www.youtube.com/watch?v=D1j823QH6cU&fmt=18
Any help is appreciated. =]
Hi einar,
a long time responding - sorry. Yeah, it’s just my library’s proxy that gives 404 errors for sites that it doesn’t want to proxy for. For example, if i access http://www.sciencedirect.com through the proxy, it goes through just fine. But http://www.facebook.com returns a 404, since the proxy server doesn’t want to be serving facebook traffic to the whole university.
I suppose I could ask for a list of sites that it proxies, and add those to a list in redirector, or something like that. Then i’d have to keep it up to date, etc. I hadn’t thought about having two instances of FF open - thanks for the idea.
best,
allie
Any idea how to actually make it working under 3.01/Minefield?
This plugin on my system so far couldnt redirect anything, either when clicking on links inside pages or typing in the address bar.
Hi Allie
It’s been tested and worked on 3.0 and worked there. Can you tell me a little more, which operating system are you on, specifically which urls did you try that didnt work, can you see any error messages in the error console?
Right,
XP SP3, Firefox loaded with plugins, have currently two copies, one 3.01 another one is minefield 3.1a2pre.
for instance
http://www.google.com/test
http://*google.com*
https://secure.wikimedia.org/wikipedia/en/wiki$2
That rule is added to redirector.
Now I’m going to a new tab, type http://www.google.com/b and nothing happens
I.e. it still goes to that page http://www.google.com/b and doesnt find it.
However, as I typed it I tried it at another copy of FX here (different computer) and this rule seems to work…
So when I get back to that computer I’ll try to see if theres any plugin intefering with the Redirector or something…
Hi, first thanx for the extension, it’s very convenient. sorry i’m a noob, but i’m trying to redirect all thumbnail images (s_…jpg and m_…jpg ) originating from myspacecdn.com to larger (l_…jpg) version ones when i click on them. example url:
http://a156.ac-images.myspacecdn.com/images01/52/s_d4f1ae60d0717b3591856b4ac48b8bcb.jpg
but the expression has to be dynamic, since the code before .ac-images and numbers after myspacecdn.com/ are different for different images.
any help would be appreciated, thanks
-sam
btw sorry if this is duplicated
Hi Sam
I’m on vacation and so don’t have my computer or anything but my first attempt would be to use a simple wildcard substitution and have something like:
include pattern: http://*.ac-images.myspacedn.com/images*/*/s_*.jpg
redirect to: http://$1.ac-images.myspacedn.com/images$2/$3/l_$4.jpg
(Of course this depends on that the numbers are at least the same for the small and large versions of the same image)
If that doesn’t work for you, send me an email in about 3 days, then i´ll be home and can figure it out properly for you. My name is einar and my domain is einaregilsson.com, you can probably guess my email address from that
crap, the comment system ate my dollar signs. This wont work, cant figure it out right now, email me in a few days and i´ll figure it out for you.
Hi again, I tested it on my original computer, and it still refuses to work.
I did exactly same settings as I described, it worked on one computer (with 3.01) and apparently doesnt on another (minefield).
really what could possibly be wrong here?
http://i38.tinypic.com/b6bpko.png
Ok, I figured it out, if anyones interested the solution was:
pattern: http://(.*).ac-images.myspacecdn.com/(.*)/(.*)/(s|m)_(\S+)
redirect: http://$1.ac-images.myspacecdn.com/$2/$3/l_$5
There is one problem though, if I copy+paste the image link into the urlbar and press enter, or middle-click the “View Image” context menu (which makes images load in new tab in the background), the redirector doesn’t work in these cases. Redirect seems to only work if I left-click “View Image”, or click (or middle-click) on a direct link to the image. I understand most people wouldn’t need this functionality (redirecting images) in the first place, but is this simply a bug or is it impossible to change this behaviour? Thanks
-sam
Ok I figured it out, if anyones interested the solution was:
pattern: http://(.*).ac-images.myspacecdn.com/(.*)/(.*)/(s|m)_(\S+)
redirect: http://$1.ac-images.myspacecdn.com/$2/$3/l_$5
There is one problem though, if I copy+paste the image link into the urlbar and press enter, or middle-click the “View Image” context menu (which makes images load in new tab in the background), the redirector doesn’t work in these cases. Redirect seems to only work if I left-click “View Image”, or click (or middle-click) on a direct link to the image. I understand most people wouldn’t need this functionality (redirecting images) in the first place, but is this simply a bug or is it impossible to change this behaviour? Thanks
-sam
@egh: that is really strange. Maybe some other extensions conflicting with it on the computer where it doesn’t work? What happens when you press the ‘Test pattern’ button?
Ok, I figured it out, if anyones interested the solution was:
pattern: http://(.*).ac-images.myspacecdn.com/(.*)/(.*)/(s|m)_(\S+)
redirect: http://$1.ac-images.myspacecdn.com/$2/$3/l_$5
There is one problem though, if I copy+paste the image link into the urlbar and press enter, or middle-click the “View Image” context menu (which makes images load in new tab in the background), the redirector doesn’t work in these cases. Redirect seems to only work if I left-click “View Image”, or click (or middle-click) on a direct link to the image. I understand most people wouldn’t need this functionality (redirecting images) in the first place, but is this simply a bug or is it impossible to change this behaviour? Thanks
-sam
sorry if this comment is duplicated
trying one last time to leave a comment, sorry if its duplicated..
I figured it out, if anyones interested the solution was:
pattern: http://(.*).ac-images.myspacecdn.com/(.*)/(.*)/(s|m)_(\S+)
redirect: http://$1.ac-images.myspacecdn.com/$2/$3/l_$5
There is one problem though, if I copy+paste the image link into the urlbar and press enter, or middle-click the “View Image” context menu (which makes images load in new tab in the background), the redirector doesn’t work in these cases. Redirect seems to only work if I left-click “View Image”, or click (or middle-click) on a direct link to the image. I understand most people wouldn’t need this functionality (redirecting images) in the first place, but is this simply a bug or is it impossible to change this behaviour? Thanks
-sam
Looks it is an issue with some plugins.
I’ve installed a Minefield copy on the computer where redirector works already (with 3.01) and it works here as well.
Thing is though that majority of plugins on both installs (working and nonworking redirectors one) are identical….
Hey, I’m not sure if my original comment went through. I’ll submit it again as it still says “Your comment is awaiting moderation.”
Original Comment:
Hi, I read through the comments & tried to understand the patterns & examples so that I didn’t have to post a question…But it’s not working for me. I think it’s because it’s late & I am sleepy…So brain no worky right now. I’m sure my redirect is simple though.
I want all YouTube links to have “&fmt=18″ added to the end of the link. Example:
http://www.youtube.com/watch?v=D1j823QH6cU
becomes
http://www.youtube.com/watch?v=D1j823QH6cU&fmt=18
Any help is appreciated. =]
Hi, i am just wondering if my second comment got through? I submitted it multiple times before it showed that the comments were awaiting moderation, but they haven’t appeared on the page. Is there another way to contact the extension author?
Hi everybody. I’ve been on vacation and haven’t been able to answer much here for the last two weeks. Also there are some problems here, comments with more than 2 urls were marked as spam and since the patterns people are asking about are mostly urls legal posts kept getting thrown out. I’ve fixed it now to allow up to 6 urls in a single comment. Another thing, the dollar sign is often used in redirect patterns but seems to disappear in the comments in Wordpress for that reason.
So, I’ll try to start answering again, and you can also email me at redirector (at) einaregilsson.com
-einar
@Dom: Hi, try this:
Include pattern: http://(www\.)?youtube.com/watch\?v=(.*)
Exclude pattern: &fmt=18
Redirect to: http://youtube.com/watch?v=$2&fmt=18
Set pattern type to ‘regular expression’.
Hope this helps,
Einar
@sam: When you’re directly viewing an image there is something different in the way it loads compared to a webpage. I might look at it in a future version but it’ll be a while.
Hi, my redirector entries only last for the current Mozilla session. When Mozilla is closed and started again, it is empty every time and i have to redo the redirects from scratch. Is this a feature?
Thanks,
e.l.
Hi Erik
No, definitely not a feature. The entries should be saved in your about:config.
Try entering about:config into your url bar after you’ve created an entry, and filter for ‘extensions.redirector.redirects’ and check whether there’s anything there.
Hi,
I’m back with a few more attempts to get URLs to redirect to sites’ SSL versions. I have this for Wikipedia and Wiktionary:
Include: http://(\w+)\.(wikipedia|wiktionary).org(/.*)
Redirect: https://secure.wikimedia.org/$2/$1$3
This works for all language Wikipedia and Wiktionary pages, and you can easily add more Wikimedia projects. Anyway, the problem is that the main pages (for example, http://en.wikipedia.org/) redirect to the actual main pages (http://en.wikipedia.org/wiki/Main_Page), but the SSL version is stuck at, for example, https://secure.wikimedia.org/en/wikipedia/, rather than redirecting to https://secure.wikimedia.org/en/wikipedia/. I am trying to solve this problem with Redirector as well, but there are a few issues:
1. If Redirector redirects a URL, and the redirected URL is in another configured include pattern, it does not get redirected a second time.
2. I cannot figure out how to specify an explicit forward slash. Due to issue #1 (right above), I decided to try excluding the main page from my original Wikipedia/Wiktionary pattern, and creating a separate configuration for the main page. But the following does not work for some reason:
Exclude: http://(\w+)\.(wikipedia|wiktionary)/
This exclude is a part of the original configuration. When this is enabled, all pages (not just the page with nothing after the last forward slash) are caught by this pattern, and thus excluded. Similarly, if I try to set up a second rule which properly redirects this URL, it catches all Wikipedia/Wiktionary URLs and redirects them to the main page of the SSL version.
Any ideas?
Oops, a few typos:
“Redirect: https://secure.wikimedia.org/2/13″ should be “Redirect: https://secure.wikimedia.org/$2/$1$3″
“rather than redirecting to https://secure.wikimedia.org/en/wikipedia/” should be “rather than redirecting to https://secure.wikimedia.org/en/wikipedia/wiki/Main_Page”
Looks like there’s a problem with your comment system. The second URL in my second post should have dollar signs before the numbers.
Hi
I think the problem might be that you’re not anchoring your regular expressions. Example: The regular expression ‘ab’ would match ‘abjohn’, it doesn’t need to match the whole string to be a match. However if you have the regex ‘^ab$’ then that could only match exactly ‘ab’, not ‘johnab’ or ‘abjohn’. So what is probably easiest for you to do is anchor the exclude pattern at the end, so Exclude: http://(\w+)\.(wikipedia|wiktionary)/$
(There might be a better way to do this all in one, I’m not at my own computer right now and can’t check it properly)
And yes, wordpress autolinks urls and removes $ signs in them for some reason. I need to create some small hack to fix that so that people can enter their patterns here without them getting screwed up.
Thanks a lot, that worked great!
Here are my final configurations, in case anyone wants them
Include: http://(\w+)\.(wikipedia|wiktionary).org(/.*)
Exclude: http://(\w+)\.(wikipedia|wiktionary).org/$
Redirect to: https://secure.wikimedia.org/$2/$1$3
and
Include: http://(\w+)\.(wikipedia|wiktionary).org/$
Exclude: https://secure.wikimedia.org/$2/$1/wiki/Main_Page
Why is it that this doesn’t seem to work for me?
I want to create a redirect that sends me to, for example,
http://id.aaa.com/=?http://aaa.com/site
when I go to http://aaa.com/site
as you can see, http://aaa.com/site recurs in the destination URL, but I put include pattern as (wildcard)
http://aaa.com/site*
and exclude patter as (wildcard)
http://id.aaa.com/*
And when I try to use it by entering http://aaa.com/site in the address bar, it does redirect me to http://id.aaa.com/=?http://aaa.com/site
but tries to keep redirecting to the same destination.
I know that when the rule and the address would result in recursive redirecting, I get a dialogue box telling me that it will happen, and in this case, I don’t get the message and still the thing keeps redirecting.
How can I solve this problem? Am I doing something wrong?
Hi
I’m not sure why that happens, the exclude pattern should make sure that the redirected url is not considered. Try something else:
Select ‘Regular expression’ as pattern type
Include: ^http:\/\/aaa\.com\/(.*)
Redirect to: http://id.aaa.com/=?http://aaa.com/$1
The ^ at the start of the include pattern means that it should only match urls that start with http://aaa.com, not urls that have it somewhere in the url. See if that works for you. However, the exclude should have worked according to your description of your patterns, so maybe that’s a bug I’ll have to look into.
Thank you for the answer.
I think I got what the problem is though.
The target address actually redirects back to the original address. This is actually for auto logon purpose and the destination address is the logon address. After logon is complete, it tries to direct me back to the original address, (i.e. http://aaa.com/site) but of course that redirector kicks in and directs it once again to the destination address.
So I guess the only way to solve this problem would be allowing redirector to redirect only once in a certain amount of time (which would be bad if the internet occasionally gets slow and it take long time to load the page) or redirect with a prompt dialogue asking whether it should redirect or not (but then that’s an extra click of a mouse….)
In any case, this is a very beneficial and convenient add-on. Thanks a lot.
nice tool .. thanks
Hi Einar,
First let me congratulate you on what probably became my most useful Firefox extension.
I only have one gripe. On your short tutorial, first you should dedicate some lines to us common earthlings who just want to do something as simple as redirecting from http://www.mysite.com/… to http://mysite.com/…
(by the way for those looking for the same->
include: http://www.mysite.com/*
redirect to: http://mysite.com/$1 )
Eventually I got there through trial and error, because reading your tutorial covering more elaborated redirects and other users more advanced requests I just got more and more confused. Maybe it’s right there in front of my eyes and I can’t see it.
But if I’m right, please just add a simple paragraph with this simple example. It may help many users.
Assume I have a link like this: http://www.site.com/gallery.php?url=www.othersite.com%2FdirA%2FdirB%2Fpage.html&otherparameter=yada that I want to redirect to http://www.othersite.com/dirA/dirB/page.html directly. There could be any http URI as the uri parameter…
Is this possible? (Don’t think so)
Hoping for something like:
Include pattern: http://www.site.com/gallery.php\?url=([^\&]+)\&
Redirect to: unescape($1)
Or have an “Unescape” checkbox or something…
I see you have a subversion archive. This patch (mangled by line wrap):
Index: chrome/content/redirector.js
===================================================================
— chrome/content/redirector.js (revision 167)
+++ chrome/content/redirector.js (working copy)
@@ -94,7 +94,11 @@
RedirLib.debug(’%1 matches exclude pattern %2′._(url, redirect.excludePattern));
return null;
}
- return this.regexMatch(redirect.pattern, url, redirect.redirectUrl);
+ var match = this.regexMatch(redirect.pattern, url, redirect.redirectUrl);
+ if (match) {
+ match = unescape(match);
+ }
+ return match;
}
return null;
},
Does the trick, but, of course: badly! Because the unescape is done unconditionally. How would you feel about putting in a boolean preference for unescaping so it would be “if (match && redirect.unescape)” {} instead? Or perhaps, even better make it a redirect.eval boolean.. Then redirect to could be any javascript, such as unescape($1)…
What do you think?
Peter
Addendum to my previous post: See it as an idea description: Such a fix should probably go into wildcardMatch() and regexMatch() instead of getRedirectUrl(), since these two are called by testPattern() (the “Test Pattern” button) but getRedirectUrl() isn’t. And my above patch only did it for regexps anyway.
And bad test case too. Should be:
Redirect to: “http://” + unescape($1)
if eval is implemented (which is probably much more useful than hardcoding unescape() which just happened to be what I need! :-))
Hi,
Hoping you can help. I would like to be able to send my browser to a standard page if the window being opened contains the following:
i.e.
https://www.url.com/dir/account/mybill/PrintDownload.action?tk=D25zS9DqPn
send to
https://www.url.com/dir/accountholder/mybill/BillingSummary.action?tab=billsummary#
Thanks
Andrew
@Virgilio: Thanks for the tip. In the next release I’ll try to add some simpler examples for the most common cases
@Peter: That seems like a good idea, especially eval. That could help some people that have been asking for more complex things as well, since basically it would allow you to do whatever javascript can do. I’ll look into it for the next release (which might be a few weeks).
@Andrew:
I would add something like (using a wildcard match):
Pattern: https://www.url.com/dir/account/mybill/PrintDownload.action?tk=*
Redirect to: https://www.url.com/dir/accountholder/mybill/BillingSummary.action?tab=billsummary#
If you need the ‘D25zS9DqPn’ part to be present in the destination you could use $1 where you need it. Hope this helps.
Hi einar,
Please scratch that,
I just noticed Virgilio’s post above, and just tried it now, and it appears to be working. Facebook’s loading perfectly.
Great addon. Thank you
Thank you for this extension. I am trying to use it, but there is a problem.
There is a strange effect with Tab Kit extension. It breaks the tab grouping by opener. In a new Firefox profile, install Tab Kit and leave options at default. Visit Google homepage. Middle-click Advanced Search link. It opens in a new tab to the right. The two tabs are colored the same. This is tab grouping by opener. Now, install Redirector and repeat same Google visits. The two tabs are now grey (i.e. not of the same group). Somehow, the first tab (Google homepage) has lost its ‘opener’ status over the second tab (Advanced Search).
However, instead of middle-click, the right-click context menu to open link in new tab is unaffected.
Using: Redirector 1.6, Tab Kit 0.4.3, Firefox 2.0.0.16, WinXP Pro SP3.
Awsome addon! However i have a troubble when it works on one machine and not on another (with same config), is there a way to debug the addon to see exactly what happens?
NOTE: I use it to surf (from the internet) a site that redirects to its lan ip (192.168.x.y) so slow redirects will be very slow and timeout.
@mattias: That sounds strange, they should work the same on every computer. You can go to about:config and set the item ‘extensions.redirector.debug’ to ‘true’. Then you can go to Tools->Error Console and you’ll get some info about what’s happening at every point. The debug output was not meant to be user friendly info or anything so don’t expect too much but it might help.
Thanks, it did help to show that the problem was elsewhere
Hi, great extension! (and a small bug fix)
After installing you extension, I got an error message complaining nsBrowserStatusHandler being invalid.
I though: “This is strange”, since I remember distinctivly using your extension before without any trouble.
My guess is that another extension of mine: autoHideStatusbar is probably messing around with firefox, and your code assumes it should be there all-the-time.
The fix is simple, just check the existance of nsBrowserStatusHandler before running the code in overrideOnStateChange().
In other words, insert the following line of code at line 55:
if (typeof nsBrowserStatusHandler==”undefined”) return;
That’s it, great extension, love it!
Gal Szkolnik
Hi Einar,
First of all: thanks for this really useful addon.
I need to do something slighly different, and wondered if it is possible to
use redirector for this.
I am trying to set up the following: when accessing a particular URL, I want to redirect to a different target URL, but *only* if that target URL exists. If the target URL does not exist no redirect should take place and the original URL should be shown.
I have played with the ‘only if link exists’ checkbox, but that seems to check if the original URL exists, not the target URL.
One use I have for it is on a laptop that will show the intranet homepage when the browser starts up if it is connected to the intranet, or a local file if the intranet can not be reached. Any suggestions?
Thanks,
Paul
Thanks for a useful add-on.
Here’s how to avoid SearchWiki, if desired (so that all the icons don’t litter the search results). At least, it seems to be working for me now.
Based on info here: http://groups.google.com/group/Google_Web_Search_Help-UsingWS/browse_thread/thread/3d76baecf04b18d3/8a2f0c6c8d2462d1?lnk=gst&q=SearchWiki#8a2f0c6c8d2462d1
Include: http://www.google.com/search?hl=en&q=*
Exclude: [leave blank]
Redirect to: http://www.google.com/search?hl=en&hl=all&q=$1
Select “Wildcard”
Cheers!
@Paul: Only if link exists means that if you’re redirecting from page A to page B then the redirect should only happen if there exists a link to page B on page A. It’s whether the link exists, not the page itself. As for your idea, it would be possible to implement but would probably be really slow. If you go to a nonsense url in your browser it takes a few seconds while it tries to resolve it, the same thing would happen if it were a part of the extension. I’ll keep it in mind for the next version but I probably won’t start work on that for a while.
Hello, I love this addon but I am having difficulties getting this to work with a javascript link. For example can i redirect this direct link from a webpage
javascript:fncSubmitChoice(R