My task is to write a Firefox extension which analyses URL requested
by the user and redirect the browser based on some criteria (say, if
the user enters http://server_.com, it redirects the user to http://server.com).

I think I know how to solve the first half of the problem (hooking and
analysing the url): I just redefine onStartURIOpen method of
nsIURIContentListener interface.
However I have no idea how to solve the second half (redirection). I
tried to do the following:
onStartURIOpen : function(uri)
{
 if (redirectRequired(uri)) // redirectRequired is implemented by me
 {
   getBrowser().mCurrentTab.linkedBrowser.loadURI(newUrl);
   return true;
 }
 return false;
}
however this results in calling onStartURIOpen over and over again.
Can anyone help me to implement redirection in my case?

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to