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

1K
Views
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
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!