Advertisement
wojaovlad

redirect.js

Sep 17th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.59 KB | None | 0 0
  1. var host = "https://2ch.hk/b/";
  2.  
  3. chrome.tabs.query({
  4.     'active': true, 'currentWindow': true
  5.     }, function (tabs) {
  6.     var url = tabs[0].url;
  7.     host = host+url;
  8.     console.log(url);
  9.     });
  10.  
  11. chrome.webRequest.onBeforeRequest.addListener(  
  12.     function(details) {
  13.  
  14.         if (localStorage.check_box == "true"){
  15.             console.log("start_1");
  16.  
  17.          return {redirectUrl: host};
  18.         }
  19.     },
  20.     {
  21.         urls: ["https://www.amazon.com/" ],
  22.         types: ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"]
  23.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement