from Hacker News

New in Chrome 120 back button detection

by clementmas on 12/6/23, 2:13 AM with 26 comments

  • by snailmailman on 12/6/23, 2:36 AM

    Does this mean websites can now hijack android’s OS-level back button? In addition to hijacking the browser level one?

    I hate when I hit back, but instantly redirect to the same page. This is so frustrating when it happens. And it happens even on major sites. (Microsoft’s official community “answers” forums have given me this issue lately. Fills up search results and then traps you there)

  • by akersten on 12/6/23, 2:33 AM

    The <details> name attribute example doesn't actually use the name attribute? Am I missing something?
  • by ggregoire on 12/6/23, 3:51 AM

    > CloseWatcher API

    > Chrome 120 brings the solution with CloseWatcher, a new API for directly listening and responding to close requests.

    > watcher.addEventListener("close", () => document.querySelector("#sidebar").classList.remove("open"));

    Couldn't they add an HTML attribute onCloseRequest?

    Slightly related, I wish there was an attribute "onClickOutside" so we could close modals and dropdown menus without manually adding an event listener on the window and checking if the click wasn't inside the element.

  • by chrismorgan on 12/6/23, 3:57 AM

    I don’t think I ever like accordions where you can only have one item open at a time. So often I just want to open them all, and probably wish you hadn’t collapsed them in the first place. Well, at least if people start doing it this way I can make a simple user script to just remove name attributes from <details> elements.
  • by clementmas on 12/6/23, 2:32 AM

    I wish I'll be able to use the CloseWatcher API to replace my history API hack to close dialogs. As always, we're now waiting for browser support
  • by rasz on 12/6/23, 6:33 AM

    >Permission policy violation reports

    How about my User Agent working for me instead? and doing exactly what I want and not some web page?

  • by tuatoru on 12/6/23, 3:29 AM

    Yet another reason to use something other than Chrome.