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

✨New action for closing or navigating a window. #19962

Merged
merged 3 commits into from Dec 21, 2018

Conversation

aghassemi
Copy link
Contributor

@aghassemi aghassemi commented Dec 18, 2018

Adds a new closeOrNavigateTo() action.

This action tries to close the window if allowed, otherwise it navigates similar to the existing navigateTo Action. Useful for use-cases where a "Back" button may need to close the window if it were opened in a new window from previous page or navigate if it wasn't opened.

If window has an opener and does not have a parent and is not part of a multi-doc shadow root, we will try to close the window. Otherwise or if browser denies window.close for whatever reason, we navigate.

Closes #19683

@aghassemi aghassemi changed the title New action for closing or navigating a window ✨New action for closing or navigating a window. Dec 18, 2018
@aghassemi
Copy link
Contributor Author

/to @sparhami
/fyi @dvoytenko @choumx

src/service/standard-actions-impl.js Outdated Show resolved Hide resolved
src/service/standard-actions-impl.js Outdated Show resolved Hide resolved
src/service/standard-actions-impl.js Outdated Show resolved Hide resolved
src/service/standard-actions-impl.js Outdated Show resolved Hide resolved
test/functional/test-standard-actions.js Outdated Show resolved Hide resolved
test/functional/test-standard-actions.js Outdated Show resolved Hide resolved
@aghassemi
Copy link
Contributor Author

@sparhami Thanks for the review, great feedback. All done.

@aghassemi aghassemi merged commit a4bd600 into ampproject:master Dec 21, 2018
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request Mar 22, 2019
* New action for closing or navigating a window

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

Successfully merging this pull request may close these issues.

Similar to javascript:window.close() feature
3 participants