Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda