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

1K
Visualizações
why net::ERR_UNSAFE_REDIRECT in chrome when redirecting to 'data:' links?

I developing new extension for google chrome browser, and now I stacked this task:

  1. Use chrome.webRequest.onBeforeRequest to intercept the request.
  2. Prevent the request from executing (but not completing its error) by redirecting to a link like data:text/javascript;charset=utf-8, (empty js).

developer chrome docs says, that I can do it like this:

chrome.webRequest.onBeforeRequest.addListener((details)=>{
    //some if statments and etc...

    return { redirectUrl: 'data:text/javascript;charset=utf-8,'}

}, {urls: ["<all_urls>"]}, ["blocking"]);

And I am very sure it's allowed to redirect to data: links like this, because of this docs:

redirectUrl Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method. Redirects from URLs with ws:// and wss:// schemes are ignored.

from this documentations

But when I tries to do this, I see this error in console: net:ERR_UNSAFE_REDIRECT

So, what is my problem?

P.S. in my mainfest.json I have this permisions:

"permissions": [ "webNavigation", "tabs", "webRequest", "webRequestBlocking", "<all_urls>", "notifications", "storage", "contextMenus", "unlimitedStorage" ],
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