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

528
Views
En Chrome-Extension, se obtiene un error CORB al inyectar un script externo

Estoy creando una extensión de Chrome y quiero inyectar un archivo Javascript en DOM desde el archivo content.js, pero después de inyectar el archivo JS, Cross-Origin Read Blocking (CORB) blocked cross-origin response https://raw.githubusercontent.com/avinashiitb/bookmark-preview/main/injectScript.js

La idea detrás de inyectar injectScript.js es escribir un evento personalizado en DOM y pasar ese evento al script content.js

Manifiesto.Json

 { "manifest_version": 2, "name": "Preview & Bookmark", "author": "Aviansh", "version": "0.001", "content_scripts": [ { "matches": ["*://*/*"], "js": [ "content.js" ], "css": [ "style.css" ] } ], "background": { "scripts": [ "background.js" ] }, "web_accessible_resources": [ "inject-script.js" ], "browser_action": {}, "permissions": [ "storage", "*://*/*" ] }

Contenido.js

 function injectScript(file_path, tag) { var node = document.getElementsByTagName(tag)[0]; var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('src', file_path); node.appendChild(script); } injectScript("https://raw.githubusercontent.com/avinashiitb/bookmark-preview/main/injectScript.js", 'body');

inyectarScript.js

 alert("Hi");
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  1. Descargue el script desde la URL remota a su directorio de extensiones.
  2. Cámbiele el nombre a inject-script.js
  3. Ejecútelo como se muestra en el método 1 aquí :
 var s = document.createElement('script'); s.src = chrome.runtime.getURL('inject-script.js'); s.onload = function() { this.remove(); }; (document.head || document.documentElement).appendChild(s);
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!