"This web page was reloaded because a problem occurred."
I am using the following userscript
// ==UserScript==
// @name Redirect DDG
// @match https://*.duckduckgo.com/*
// @run-at request
// ==/UserScript==
{
"id": 1,
"priority": 1,
"action": {
"type": "redirect",
"redirect": {
"transform": { "scheme": "https", "host": "search.brave.com", "path": "search" }
}
},
"condition": { "urlFilter": "||duckduckgo.com/?", "resourceTypes": ["main_frame"] }
}
Whenever the redirection occurs, safari gives the above error.
macOS 13.4 Safari 16.5
I tested, it see the reload message. Weird.
Can you check this one and see if the message still appears when getting redirected from ddg to example.com?
// ==UserScript==
// @name Redirect example
// @run-at request
// ==/UserScript==
{
"id": 1736,
"priority": 1,
"action": {
"type": "redirect",
"redirect": {
"transform": { "scheme": "https", "host": "example.com", "path": "/" }
}
},
"condition": { "urlFilter": "||duckduckgo.com/?", "resourceTypes": ["main_frame"] }
}
Hi @quoid,
I tried your code. For the first time, it gave me the error, but after that it has been redirecting without any issue.
Have you figured out the cause?
Nope, I don't know why this is happening. I sent you the updated file because I wanted to see if it only affected some websites, like it does for me. Thanks for clarifying that.
I could not find any errors getting thrown by anything related to the extension. I disabled all functionality on a local build except for the logic around setting the declarative net requests, that means no script injection, no content script, nothing in background.js running except the code related to DNRs and the error still occurred.
As you can see from the implementation here, all we do on the extension side is leverage the updateSessionRules method. That does not get run on page visits and as mentioned during testing all other 'page visit code' was disabled.
As you can probably tell, I have no idea why this is happening. Perhaps it's a bug with the new version of Safari and how they handle DNRs? It's odd that it only happens on some websites... 🤔