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]: Support navigation history for the current page #13557

Open
dudicp opened this issue Jan 27, 2025 · 4 comments
Open

[Feature]: Support navigation history for the current page #13557

dudicp opened this issue Jan 27, 2025 · 4 comments
Labels

Comments

@dudicp
Copy link

dudicp commented Jan 27, 2025

Feature description

Description:
I would like to get the navigation history for the current page.

Proposed Solution:
CDP supports the ability to navigation history for the current page Page.getNavigationHistory It will be nice to have this feature exposed in Puppeteer.

@dudicp dudicp added the feature label Jan 27, 2025
@OrKoN
Copy link
Collaborator

OrKoN commented Jan 27, 2025

Could you please clarify why the existing Web API (navigation.entries()) does not fulfill your use case?

@dudicp
Copy link
Author

dudicp commented Jan 27, 2025

The Web-API (navigation.entries()) returns the entires for navigation performed on the same-origin.

While CDP Page.getNavigationHistory is returning entries cross-origin.

I have a use-case to check navigation history when navigation from domain A to domain B in the same tab.

For example example.com -> google.com:

  • Web-API: there will be only one navigation history entry.
  • CDP: there will be 2 navigation-history entries.

@OrKoN
Copy link
Collaborator

OrKoN commented Jan 27, 2025

Could you provide any high-level details about the use case (i.e., why do you need to check the cross-origin history)?

@dudicp
Copy link
Author

dudicp commented Jan 27, 2025

At a high level, I'm developing a proxy solution which using client-side code that manipulates the browser's history (via pushState and replaceState) during cross-origin navigation. I need to verify the values of the navigation entries as part of this process.

Currently, I'm able to achieve this by using Puppeteer's page._client() to send CDP commands.
However, I believe it would be beneficial to have this functionality exposed directly through the Puppeteer API.

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

2 participants