Feature request: window.close() for PWA's
Reported by
chem...@gmail.com,
Sep 22 2017
|
|||||||
Issue descriptionSteps to reproduce the problem: Right now, there is no way for a PWA to close itself like native Android apps can. I think it would make sense to allow PWA's to call window.close(). Use case: To override the back button behavior on Android, I push items to the browser's history stack (and a list for my own use since I can't pop things from the history) any time the user navigates to a new screen. When the back button is pressed, I simply prevent the browser from navigating away from the page and show the previous screen. However, when the user reaches the 'top' of the app, I can't close the window. This is behavior that the user expects. What is the expected behavior? PWA should be able to close itself What went wrong? Window.close is not allowed because the 'window' was not opened through javascript. Did this work before? No Does this work in other browsers? N/A Chrome version: Any Channel: stable OS Version: Any Flash Version:
,
Sep 22 2017
,
Sep 25 2017
,
Jan 29 2018
Any word on this? Would also be useful when PWA's replace Chrome Apps :)
,
Mar 9 2018
*** Bulk edit *** Setting Feature Requests as: Untriaged
,
Apr 24 2018
yusufo@, please reassign as needed.
,
Apr 25 2018
This seems like a pattern specific to Android. I'm not sure why we would do something like this on Desktop.
,
Apr 26 2018
Well since PWA's are going to replace Chrome Apps I assume that that will deprecate the chrome.* Api at some point, too? Then apps won't be able to close themselves. And yes, it would make a lot of sense of Android so I think that could be worth it in any case (imho 😉)
,
Apr 26 2018
Adding relevant people working on web platform, WebAPKs and TWAs. I do remember this being discussed at some point. What would be the recommendation for developers wanting to close their Activity in Android with window.close()?
,
Apr 26 2018
Hm, at least for the Trusted Web Activity case, this seems similar to the feature request to allow closing the tab from the Android side. (And possibly one could be implemented using the other?) If we do allow this from Javascript, I would probably want to require a user gesture or something.
,
Apr 27 2018
Want Matt's opinion as surely he's thought about it :)
,
Apr 30 2018
I haven't tried this, but I'm surprised that window.close() doesn't work in PWA windows. window.move() and other APIs work (at least on Desktop). Is this a mobile-only issue? Would definitely expect PWA windows to be able to close themselves. Web tabs can do so.
,
Apr 30 2018
Urr, when I try running window.close() in about:blank on desktop, I get the messsage "Scripts may close only the windows that were opened by it.".
,
May 1 2018
Hmm, apparently you can't close yourself. This doesn't seem right to me; I can't imagine an abuse case you can get from a website being able to close itself, especially if it required a user gesture. But seems like a fairly uphill battle to change HTML in that regard. If we can't globally change window.close() to allow a site to close itself, I would be in support of allowing installed PWA windows to close themselves. Not sure how this would look in a spec.
,
Oct 20
Any news? Pwas have made it onto the desktop (windows) by now ;) |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by rbasuvula@chromium.org
, Sep 22 2017Components: UI>Browser>WebAppInstalls
Labels: Needs-triage-Mobile Triaged-Mobile