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 9043673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:47:01+00:00 2026-06-16T10:47:01+00:00

This is my first time ever touching any sort of client sided web programming

  • 0

This is my first time ever touching any sort of client sided web programming language, and, I’m attempting to make my first chrome addon. Basically what I want to do is code something which redirects from:-

ABC.com/ID

to

A.ABC.com/ID

So far I have it all coded, however, what it does is it loads ABC.com/ID, waits for it to complete, then injects my content script and re-loads A.ABC.com/ID. This is obviously a huge waste of time. Is there any way I can tell chrome to load this script either before the DNS lookup (Because that’s useless, because it’s on a new subdomain), or, before opening a connection to the site (Because this isn’t the page we’re looking for)? I understand a content script may not be the best idea, if it’s not, then what would be?

  • 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-06-16T10:47:02+00:00Added an answer on June 16, 2026 at 10:47 am

    Yes, you can achieve with web request API without any content scripts. The following demonstration blocks all Facebook URL’s and redirects them to Google, similarly use ABC.com/ID instead of Facebook and use A.ABC.com/ID instead of Google for this use case.

    References

    • Web request
    • Background Page
    • Manifest File

    manifest.json

    Ensure all permissions are available and register background page with extension.

    {
      "name": "Hanlder for Navigation",
      "description": "http://stackoverflow.com/questions/14050467",
      "version": "1",
      "manifest_version": 2,
      "background": {
        "scripts": ["background.js"]
      },
      "permissions":["https://www.facebook.com/*","webRequest","webRequestBlocking"]
    }
    

    background.js

    This code blocks all URL request to Facebook and redirects them to Google.

    // Register an event listener which 
    //traces all requests before being fired
    chrome.webRequest.onBeforeRequest.addListener(function (details) {
        return {
            redirectUrl: "http://www.google.co.in/" /*Redirection URL*/
        };
    }, {
        urls: ["*://www.facebook.com/*"] /* List of URL's */
    }, ["blocking"]); // Block intercepted requests until this handler has finished
    

    Output

    All request(s) to Facebook are redirected to Google.

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

Sidebar

Related Questions

I'm relatively experienced with Object oriented programming, but this is my first time ever
This is the first time ever I'm using AJAX, and I want to do
This is the first time, I am involved in writing a complete client for
This was my first time ever trying to save object in a file, so
This is the first time I've ever tried to use JAXB for anything at
I'm a college student and this is my first time I have ever created
This is the first time I've ever tried JQuery basically because I couldnt get
This is the first time i've ever actually gotten to the point where I
I'm am super new at this, and this is my first time ever using
This is the first time I have ever used Mysqli, so when it comes

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.