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

Match any part of the URL #8

Open
sztranyovszky opened this issue Jan 16, 2025 · 1 comment
Open

Match any part of the URL #8

sztranyovszky opened this issue Jan 16, 2025 · 1 comment

Comments

@sztranyovszky
Copy link

sztranyovszky commented Jan 16, 2025

How could I match any part of the URL?

E.g. if (url.href.includes("abc")) return "ABC"; doesn't catch https://somehost.com/xyabcdef.

@icholy
Copy link
Owner

icholy commented Jan 16, 2025

Hmm, I just tried this code:

if (url.href.includes("ContainerScript")) return "ContainerScript Repo";

And opened: #8 and it worked.

Edit:

I just tried the following:

if (url.href.includes("/issues")) return "Github Issues";

If you start on https://github.com/icholy/ContainerScript and click on the "Issues" tab it doesn't switch containers. I think this happens because Github is using turbolinks and doesn't actually re-load the page 🤔

Edit:

Looks like I'd need to add a pushstate/popstate listener: https://discourse.mozilla.org/t/how-to-detect-url-change-via-popstate-on-my-extension/88769

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

No branches or pull requests

2 participants