sblask-webextensions / webextension-skip-redirect

Some web pages use intermediary pages before redirecting to a final page. This add-on tries to extract the final url from the intermediary url and goes there straight away if successful.
https://addons.mozilla.org/firefox/addon/skip-redirect/
MIT License
481 stars 45 forks source link

Migration from Manifest Version 2 -> Version 3 #317

Closed ghost closed 2 years ago

ghost commented 2 years ago

Because Chrome does no longer allow blocking webRequests in MV3 there is another solution required. So, the removing of the redirect URL cannot be handled after the user clicked on a link. (Firefox will allow the blocking of webRequests furthermore, but this is a special handling.)

So the removing of the redirect links has to be handled inside the DOM link elements (by changing the href of <a href="…"). This is a complete different implementation, it's handled mainly inside a content script.

Because of replacing the redirect with the target link inside the DOM, the user will no longer bothered with the unwanted redirect links. If he moves the mouse over a link, he sees the final target URL and can copy that link easily. Because of this, the context menu items are no longer needed.

Also, it's no longer needed to inform the user about the changing of the URLs, because he sees the final URL if he looked about it. Because of this, notifications are no longer needed too.

But maybe the user want's to know, that a link will skip a redirect, an indicator will be shown after the link. Indeed this is disable inside the options.

Now, this extension knows the number of redirect links, since it changes the href of it. So the icon badge can now show the number of skipped redirect URLs.

Since only links will be handled, there is no problem further more with forms. They will be still sending to the redirect URLs, like often needed, even it's a GET request.

The broswer-polyfill.js made a lot of trouble, so it was removed. MV3 supports all required features, so polyfill is no longer required.

As soon, as Firefox supports MV3, these changes should work as well with it too.

PS SVG icons are not supported in Chrome. So they was replaced by PNG icons.