Don't redirect when already on a redirectable site #10

Closed
opened 2022-11-09 11:55:27 +00:00 by Bauke · 1 comment
Owner

From Cfabbro's request.

Not redirecting on manual navigation could maybe be done using the omnibox.onInputEntered API, by saving the URL entered in local storage and then checking it inside onBeforeNavigate whether it should cancel a redirect. To use the omnibox API, the extension has to define a keyword for the user to activate. So, it can't be done for everything this way.

Then remembering to not redirect could maybe be done using the tabs API by querying the current tab and seeing if it's a URL that can be redirected, and then canceling it based on that. Say you have an example.org redirect and you are on that website, meaning you weren't redirected for whatever reason, then maybe it's safe to assume you don't want to be redirected anyway? I don't think this works with opening links in a new tab though. It does.

I'll have to do some experimenting.

From [Cfabbro's request](https://tildes.net/~tech/139s/re_nav_a_webextension_to_create_custom_redirects_for_any_website#comment-7k5p). ~~Not redirecting on manual navigation could maybe be done using the [`omnibox.onInputEntered`](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/omnibox/onInputEntered) API, by saving the URL entered in local storage and then checking it inside `onBeforeNavigate` whether it should cancel a redirect.~~ To use the omnibox API, the extension has to define a keyword for the user to activate. So, it can't be done for everything this way. Then remembering to not redirect could maybe be done using the tabs API by querying the current tab and seeing if it's a URL that can be redirected, and then canceling it based on that. Say you have an `example.org` redirect and you are on that website, meaning you weren't redirected for whatever reason, then maybe it's safe to assume you don't want to be redirected anyway? ~~I don't think this works with opening links in a new tab though.~~ It does. I'll have to do some experimenting.
Bauke added this to the Version 0.2.0 milestone 2022-11-09 11:55:27 +00:00
Bauke added the
Feature Request
label 2022-11-09 11:55:27 +00:00
Bauke self-assigned this 2022-11-15 11:21:02 +00:00
Author
Owner

Implemented in e5bf102aa3.

Implemented in e5bf102aa3a8ff25b1c525ef3751b8c34cf278e4.
Bauke closed this issue 2022-11-15 16:26:50 +00:00
Bauke added the
Completed
label 2022-11-15 16:26:56 +00:00
Bauke changed title from Don't redirect on manual navigation and remember that to Don't redirect when already on a redirectable site 2022-11-15 16:27:22 +00:00
Sign in to join this conversation.
No description provided.