Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

273
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda