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

145
Visualizações
Cross-Domain IndexedDB Storage

I'm new to indexedDB and my goal is to create a chrome extension that keeps track of all SSO pages and their redirects. My idea is to store each sign-in link and their respective redirects in a tree; however, indexedDB creates a new database for each link that i visit, so i'm having trouble making the tree. Is there any way around this?

'''

// Record variables to be used for indexedDB
let request = window.indexedDB.open("MyTestDatabase", 2),
  db,
  tx,
  store,
  index;

// triggered when a database of a bigger version number than the existing stored database is loaded
request.onupgradeneeded = function (e) {
  let db = request.result,
    store = db.createObjectStore("URL", { autoIncrement: true }),
    index = store.createIndex("link no.", "URL", { unique: false });
};

// triggered if the database cannot load
request.onerror = function (e) {
  console.log("The database 'linkStorage' could not be opened");
};

/* triggered if it does load

    - open a transaction, define the object store ("URL")
    - creates an index for data retrieval
    - append the current link to indexedDB, console.log it, and print the index
*/
request.onsuccess = function (e) {
  db = request.result;
  (tx = db.transaction("URL", "readwrite")),
    (store = tx.objectStore("URL")),
    store.index("link no.");

  db.onerror = function (e) {
    console.log("ERROR could not open db" + e.target.errorCode);
  };

  var link = window.location.href;
  store.put(link);

  var countRequest = store.count();
  countRequest.onsuccess = function () {
    var count = countRequest.result;
    var lastLink = store.get(count);
    lastLink.onsuccess = function () {
      console.log("Index = " + count);
      console.log("Current link = " + lastLink.result);
    };
  };

  tx.oncomplete = function () {
    db.close();
  };
};

'''

about 4 years ago · Juan Pablo Isaza
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