URL Changing

Hallo,

I am new into coding and i struggle a long time with a problem, so i hope you can help me.
I learned to code a Firefox Addon with node.js, and i want to code a addon which redirect you.
F.e: you visit the site www.Test.com, and you will get redirected to www.google.com.
It’s something like this addon: https://addons.mozilla.org/de/firefox/addon/redirector/?src=search
but i cant figure out how i can do that (I spend some hours at the developersite of mozilla)

Maybe someone of you know how to code that? I think it should only be 2 commands, but i tryed nearly everything.

Thanks for help!
Daniel

Probably the approved method for a new addon would be to use the WebExtensions Response API, which incorporates a way to redirect:

There are many other methods. The addon you mention uses an external module that offers a redirect API of its own.

Thanks for your answer!
But I don’t get it…
Do you have a specific code example for me?

Thanks!

Or anybody else could help?
I do not know how to build the code.

Thanks!