Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Forbes #tracker #27

Closed
foodfan opened this issue Apr 17, 2019 · 7 comments
Closed

Feature Request: Forbes #tracker #27

foodfan opened this issue Apr 17, 2019 · 7 comments
Labels

Comments

@foodfan
Copy link

foodfan commented Apr 17, 2019

Hi, Forbes.com adds a hashtag tracker at the end of its URL's. The link works fine without it. Would be great if you could remove those. Thanks!

@jparise
Copy link
Owner

jparise commented May 24, 2019

I'm afraid I haven't figured out a reliable way to strip URI fragments from an extension so this isn't something I'm able to support at this time.

@jparise jparise closed this as completed May 24, 2019
@jparise
Copy link
Owner

jparise commented May 24, 2019

See also #10

@uBlock-user
Copy link

Why not just use URLSearchParams API ?

@jparise
Copy link
Owner

jparise commented Jul 1, 2019

@uBlock-user I wasn't familiar with that API until you mentioned it. It looks like a nice improvement over regular expressions!

Does it handle fragments though? The documentation doesn't mention that, and I don't have time to experiment with it right now.

@uBlock-user
Copy link

uBlock-user commented Jul 1, 2019

@jparise I'm not sure what you mean by fragments. Does that API support regex ? As I have a userscript and I want to add regex support but I don't think that API has any.

@jparise
Copy link
Owner

jparise commented Jul 1, 2019

@uBlock-user Fragment identifiers: https://en.wikipedia.org/wiki/Fragment_identifier

This is how Forbes is adding its tracker.

URLSearchParams would be an improvement over the current regular expression-based token stripping approach, but if it couldn't handle deleting the fragment identifier, then it couldn't be a drop-in replacement.

Separately, there is also the root issue noted in #10 where we can't match URLs with fragments without widening the rule to match all URLs, and I don't know how much of a performance regression that would cause.

@uBlock-user
Copy link

URLSearchParams would be an improvement over the current regular expression-based token stripping approach, but if it couldn't handle deleting the fragment identifier, then it couldn't be a drop-in replacement.

It seems this API can't remove params starting with #, works with ? or &, not with # :(

Tested on youtube with the js below --

(function() {
		let query = '{{1}}';
		if (location.href.indexOf(query + '=') !== -1) {
			let url = new URL(location);
			url.searchParams.delete(query);
			window.location.href = url;
		}
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants