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

fix(Page): support anchor navigation #2338

Merged
merged 2 commits into from Apr 10, 2018

Conversation

aslushnikov
Copy link
Contributor

@aslushnikov aslushnikov commented Apr 10, 2018

This patch fixes puppeteer navigation primitives to work with
same-document navigation.

In browser world, same-document navigation happens when document's URL is changed,
but document instance is not re-created. Some common scenarios
for same-document navigation are:

  • History API
  • anchor navigation

With this patch:

  • pptr starts dispatching framenavigated event when frame's URL gets
    changed due to same-document navigation
  • page.waitForNavigation now works with same-document navigation
  • page.goBack() and page.goForward() are handled correctly.

Fixes #257.

This patch fixes puppeteer navigation primitives to work with
same-document navigation.

Same-document navigation happens when document's URL is changed,
but document instance is not re-created. Some common scenarios
for same-document navigation are:
- History API
- anchor navigation

With this patch:
- pptr starts dispatching `framenavigated` event when frame's URL gets
changed due to same-document navigation
- `page.waitForNavigation` now works with same-document navigation
- `page.goBack()` and `page.goForward()` are handled correctly.

Fixes puppeteer#257.
this._eventListeners = [
helper.addEventListener(this._frameManager, FrameManager.Events.LifecycleEvent, this._checkLifecycleComplete.bind(this)),
helper.addEventListener(this._frameManager, FrameManager.Events.FrameNavigatedWithinDocument, this._navigatedWithingDocument.bind(this)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WithinDocument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@aslushnikov aslushnikov merged commit fafd156 into puppeteer:master Apr 10, 2018
@aslushnikov aslushnikov deleted the hash-navigation branch May 9, 2018 01:13
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

Successfully merging this pull request may close these issues.

Hash-only navigation doesn't work
2 participants