I am trying to port the Google Chrome extension to the Firefox Add-On SDK, and I need an extension to filter pages from my site and redirect. For example, if a user opens " http://example.com/special " I need to send him to " http://example.com/redirect " on the same browser tab.
Here is how I tried to do this:
var pageMod = require("page-mod").PageMod({ include: "*", contentScriptWhen: "start", contentScript: "", onAttach: function(worker) { if (worker.tab.url == worker.url && worker.url.indexOf("example.com/special") > -1) { worker.tab.url = "http://example.com/redirect"; } } });
The problem is that my browser sometimes freezes after a redirect (right after a new page has been displayed on a tab). What am I doing wrong?
Using Firefox 16.0.2, Add-On SDK 1.11
source share