Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6347919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:19:08+00:00 2026-05-24T21:19:08+00:00

I am attempting to create a chrome extension that scrubs a URL and opens

  • 0

I am attempting to create a chrome extension that scrubs a URL and opens the URL in a new tab. However I keep getting the same error as this (content_script error). I’ve followed instructions, but I believe I just don’t understand where I’m going wrong. Here is the full code:

manifest.json

{
  "name": "Link scrub",  
  "description": "Removes redirectors from links", 
  "version": "0.1",
  "permissions": ["contextMenus", "tabs"],
  "background_page" : "background.html"
  "content_scripts": [{
    "js" : ["linkscrub.js"]
  }];
}    

linkscrub.js

chrome.contextMenus.create({
    "title" : "Link Trap",
    "type" : "normal",
    "contexts" : ["link"],
    "onclick" : modifyLink
});
 function modifyLink(info, tab) {
    chrome.extension.sendRequest({
        "nurl" = info.linkURL,
        function(response) {
            console.log("linkscrub failed: " + response.farewell)
            }
    });
}

background.html

<script>
chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
    link = "";
    link = sender.nurl;
    link = link.match("url=\b(.*?)&link");
    chrome.tabs.create({
        "url": link,
        "selected" : false
    });
    if(chrome.extension.lastError) 
        sendResponse({farewell : chrome.extension.lastError.message});
    else
        sendResponse({farewell : "Success")};    
  });
<script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:19:10+00:00Added an answer on May 24, 2026 at 9:19 pm

    It throws error because you cannot use chrome.contextMenus.* API inside a content script.

    You don’t need a content script for this task, just move everything from linkscrub.js into your background page (also you won’t be needing those requests).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im attempting to create a new operator :? on lists, which operates the same
I have a Google Chrome extension that opens a Twitter Bootstrap dialog (using JQuery
I am attempting to create a Chrome extension to help me understand Chrome's webRequest
I am attempting to create a web page that will allow a user to
I am attempting to create a Stored Procedure for a newly created database. However
I'm attempting to create a Parcelable class in Android so that I can pass
I am attempting to create an inbound Mule endpoint that will receive Syslog messages
When attempting to create a tag of a working copy we receive the error,
I am getting this error in chrome XMLHttpRequest cannot load ttp://www.officeyoganyc.com/lists/?p=subscribe. Cross origin requests
I am attempting to create an implode that given the following array: <?php $conditions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.