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

404
Views
¿Qué hacer con los permisos en la extensión de Chrome basada en iframe?

Estoy haciendo una extensión de Chrome que tiene un iframe. Cuando la extensión solicita al servidor obtener la página, devuelve un error Se Refused to display 'https://subdomain.example.com/' in a frame because it set 'X-Frame-Options' to 'deny' . Aunque configuré x-frame-options para deny en mi archivo .htaccess y agregué un header('x-frame-options: GOFORIT') en mi método específico en mi proyecto de back-end, devolvió otro error Refused to display 'https://subdomain.example.com/' in a frame because it set multiple 'X-Frame-Options' headers with conflicting values ('GOFORIT, DENY'). Falling back to 'deny' . webRequest y webRequestBlocking a los permissions en mi archivo manifest.json . No hubo suerte y devolvió 'webRequestBlocking' requires manifest version of 2 or lower y Unchecked runtime.lastError: You do not have permission to use blocking webRequest listeners. Be sure to declare the webRequestBlocking permission in your manifest. Así que webRequestBlocking de los permisos y agregué declarativeNetRequest como lo es para v3. ¡¡Sin resultados!! Luego agregué

 chrome.webRequest.onHeadersReceived.addListener( function(info) { var headers = info.responseHeaders; for (var i=headers.length-1; i>=0; --i) { var header = headers[i].name.toLowerCase(); if (header == 'x-frame-options' || header == 'frame-options') { headers.splice(i, 1); // Remove header } } return {responseHeaders: headers}; }, { urls: [ '*://*/*', // Pattern to match all http(s) pages // '*://*.example.org/*', // Pattern to match one http(s) site ], types: [ 'sub_frame' ] }, [ 'blocking', 'responseHeaders', // Modern Chrome needs 'extraHeaders' to see and change this header, // so the following code evaluates to 'extraHeaders' only in modern Chrome. chrome.webRequest.OnHeadersReceivedOptions.EXTRA_HEADERS, ].filter(Boolean) );

a mi script.js , devolvió Uncaught TypeError: Cannot read properties of undefined (reading 'onHeadersReceived')

¿Qué debo hacer para permitir SOLAMENTE la extensión para solicitar al servidor?

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

0

Como dice el mensaje de error, una solución es usar "manifest_version": 2 y "webRequestBlocking" en "permissions" .

Otra solución es declarativeNetRequest , que es una nueva API con una sintaxis completamente diferente , por lo que tendrá que volver a escribir su código por completo, aquí hay un ejemplo: enlace .

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!