Last active
April 13, 2017 00:46
-
-
Save SebastianJay/909e830c25d7a79901b8b4723819d672 to your computer and use it in GitHub Desktop.
Chrome extension for URL redirection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit http://stackoverflow.com/a/4859938 | |
chrome.runtime.onMessage.addListener(function(request, sender) { | |
chrome.tabs.update(sender.tab.id, {url: request.redirect}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "URL Redirection", | |
"version": "0.1", | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"https://www.yahoo.com" | |
], | |
"js": ["redirect.js"] | |
} | |
], | |
"background": { | |
"scripts": ["background.js"], | |
"persistent": false | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit http://stackoverflow.com/a/4859938 | |
// replace the URL in manifest.json line 8 with a set of source URLs you want to redirect from | |
// replace the URL below with the destination URL you want to redirect to | |
chrome.runtime.sendMessage({redirect: "https://finance.yahoo.com/"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment