0

I'm trying to write a chrome extension to help get myself back to work (and hopefully friends too). For now, the goal is when users go to Facebook, they're redirected to a webpage that I'll make which will have a message "get back to work".

I've managed as far as setting it up, just can't manage to find the js code to redirect.

manifest.json

{
  "manifest_version": 2,

  "name": "Get Back to Work",
  "description": "GET BACK TO WORK!",
  "version": "0.1",

  "content_scripts": [
    {
      "matches": [
        "*://facebook.com/*", "*://www.facebook.com/*"
      ],
      "js": ["content.js"]
    }
  ],

  "browser_action": {
    "default_icon": "icon.png"
  }
}

content.js:

alert("this works");
//code here

Any suggestions?

2

1 Answer 1

1

just set

Window.location = "http://getbacktowork.com";

inside your content.js

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.