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

Proposal: Trigger navigation dependent APIs on JavaScript Navigation #446

Open
erosman opened this issue Sep 6, 2023 · 4 comments
Open
Labels
opposed: safari Opposed by Safari proposal Proposal for a change or new feature

Comments

@erosman
Copy link

erosman commented Sep 6, 2023

Preamble

Many websites nowadays navigate with JavaScript (e.g. Github) which is basically changing content, URL & history; without triggering a navigation.

There are a number of WebExtension APIs that depend on the navigation to function and they won't be triggered with the JavaScript navigation. e.g.

There is Navigation: navigate event supported by Chrome, Edge, & Opera; but it is not suitable for this purpose.

Proposal

Implement a method (standard or subject to a flag) to trigger navigation dependent WebExtension APIs on JavaScript Navigation (i,e, URL change)

@tophf
Copy link

tophf commented Sep 7, 2023

webNavigation already has events that trigger on JS navigation: onHistoryStateUpdated and onReferenceFragmentUpdated.

@erosman
Copy link
Author

erosman commented Sep 7, 2023

The request is mostly concerned with registered content such as scripting and content_scripts.
I will rephrase the request accordingly.

@xeenon xeenon added opposed: safari Opposed by Safari proposal Proposal for a change or new feature and removed needs-triage labels Sep 27, 2023
@xeenon
Copy link
Collaborator

xeenon commented Sep 27, 2023

Once a script is injected it can be surprising to have it injected again — likely breaking things in the process.

In my opinion, the content scripts need to listen for in-page DOM events that are available to know when script-based navigation occurs and act accordingly. If it needs more things injected then, it can message the background for it to do an executeScript, etc in response.

This does not seem like a problem the extension platform needs to solve.

@erosman
Copy link
Author

erosman commented Sep 28, 2023

Once a script is injected it can be surprising to have it injected again

JavaScript navigation would mean a new page in the same tab, hidden from webNavigation by the page owner (for some purpose). Therefore, it is not injecting into the same page.

The practice has become more popular each year and I suspect there might be a time that it might become quite widespread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
opposed: safari Opposed by Safari proposal Proposal for a change or new feature
Projects
None yet
Development

No branches or pull requests

3 participants