Implemented a JavaScript extension to redirect traffic.

Based on TrafficRedirector.py, which is also in this commit.