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

  • Home
  • SEARCH
  • 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 9256813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:03:17+00:00 2026-06-18T12:03:17+00:00

I try to write a Google Chrome extension that simply opens a new tab

  • 0

I try to write a Google Chrome extension that simply opens a new tab when I click left-right in a short interval. The JavaScript is no problem but I implemented this as a “content_scripts” script.

In some other threads I read that I can’t access the chrome.* APIs from content_scripts (except the chrome.extension API).

Even if it’s not necessary to access the chrome.tabs API to open a new window (window.open should do the job) it seems I need it though for opening a new tab with the new tab page which obviously isn’t possible via window.open.

So I can’t really figure out what is the best way to do that. I could use a background page which I could call from the content_script but I think there should be a much more simple way to do that, I just don’t get it.

Anyone have an idea?

  • 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-18T12:03:19+00:00Added an answer on June 18, 2026 at 12:03 pm

    I think your content script will have to send a message to your background page to invoke chrome.tabs.create – content scripts cannot use the chrome api, nor can they directly communicate with the background page.

    Here’s a reference about message passing inside Chrome extensions for further detail, but here’s the example code ( modified from the example in said reference )

    // in background
    chrome.extension.onMessage.addListener(
      function(request, sender, sendResponse) {
        switch ( request.action) {
           case 'newTab' : {
             //note: passing an empty object opens a new blank tab, 
             //but an object must be passed
             chrome.tabs.create({/*options*/}); 
             // run callback / send response
           } break;
        }
        return true; //required if you want your callback to run, IIRC
      });
    
    // in content script:
    chrome.extension.sendMessage({action: "newTab"}, function(response) {
      //optional callback code here.
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write an extension for Google chrome that detects snippets of source
I want to write a Google Chrome Extension that can take information from a
I try to write a dictionary extension for Google Chrome. Now, I want to
i'm using google gadget to write a short script and try to insert to
I want to write a short script so that on some event chrome will
try to write a composite component that allows mutltiple text inputs. I read that
I try to write Activator action for changing current song rating. I now that
I try to write a macro in clojure that sets up a namespace and
I just downloaded Google Chrome for iPad and I noticed that it doesn't work
I was fortunate enough to try out the Google Cr-48 for the Chrome OS

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.