Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

272
Views
How do I use the tabs API?

I am creating a program that needs to interact with other tabs on the window that the HTML file is opened on, and I found this code. However, I think that I have implemented it incorrectly as it does nothing. Here is my (incomplete) code:

HTML:

<html lang="en">

<head>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Workench</title>

    <script src="dependencies/index.js"></script>
    <link rel="stylesheet" href="dependencies/index.css">

</head>

<body>

    <nav id="toolbar">

        <div id="file">

            <label>File</label>

            <br>

            <button onclick="toolbar.file.saveDoc()">Save</button>
            <button onclick="toolbar.file.newDoc()">New</button>
            <button onclick="toolbar.file.loadDoc()">Load</button>

        </div>

        <div id="upload">

            <label>Upload</label>

            <br>

            <button onclick="toolbar.upload.seasaw()">Seasaw</button>
            <button onclick="toolbar.upload.googleClassroom()">Google Classroom</button>

        </div>

    </nav>

</body>

JavaScript:

import "browser";

const toolbar = {

    file : {

        saveDoc () {

            browser.tabs.create({url: "docs.google.com"}).then(() => {
                browser.tabs.executeScript({
                  code: "console.log('hello');"
                });
              });

        },

        newDoc () {

            

        },

        loadDoc() {

            

        }

    }

};

Any help would be appreciated! :)

For context, this is for my school. It needs to essentially be a text editor that then automatically uploads the text to the platforms that my school uses.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is that docs.google.com has not provided you permission for this, see the page you have shared

enter image description here

You will need to make sure you have host permissions for the URLs you intend to interact with.

I advise you to first try this with pages of the same domain opened in a new tab and when that works, you may venture into the usage with different domains.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!