A new spam policy for "back button hijacking"

(developers.google.com)

184 points | by zdw 3 hours ago

29 comments

  • andreareina 1 hour ago
    > Notably, some instances of back button hijacking may originate from the site's ... advertising platform

    I feel like anything loaded from a third party domain shouldn't be allowed to fiddle with the history stack.

    • kvdveer 49 minutes ago
      While i agree, the current JS security model rally doesn't allow for distinguishing origin for JS code. Should that ever change, advertisers will just require that you compile their library into the first party js code, negating any benefit from such a security model.
      • lmm 42 minutes ago
        > advertisers will just require that you compile their library into the first party js code, negating any benefit from such a security model.

        It will become harder for advertisers to deny responsibility for ads that violate their stated policies if they have to submit the ads ahead of time. Also site operators will need a certain level of technical competence to do this.

    • friendzis 6 minutes ago
      Nothing loaded from the web should be able to fiddle with any browser behavior, yet here we are.
    • apatheticonion 7 minutes ago
      There are valid use cases however the issue is rooted in lacking browser APIs.

      For instance,

      - if you want to do statistics tracking (how many hits your site gets and user journeys)

      - You have a widget/iframe system that needs to teardown when the SPA page is navigated away

      - etc

      The browser does not have a;

         globalThis.history.addEventListener('navigate')
      
      So you must monkey patch the history API. It's impractical from a distribution standpoint to embed this code in the page bundle as it's often managed externally and has its own release schedule.
      • friendzis 2 minutes ago
        > - if you want to do statistics tracking (how many hits your site gets and user journeys)

        You can do all of that server-side and much more reliably at that. The only reason to do any of this tracking client-side is advertisers trusting fake number go up more than sales numbers.

  • p4bl0 42 minutes ago
    That's cool if they can make it work.

    I don't understand how Google's indexing work anymore. I've had some website very well indexed for years and years which suddenly disappeared from the index with no explanation, even on the Search Console ("visited, not indexed"). Simple blog entries, lightweight pages, no JavaScript, no ads, no bad practices, https enabled, informative content that is linked from elsewhere including well indexed websites (some entries even performed well on Reddit). At the same time, for the past few years I've found Google search to be a less and less reliable tool because the results are less often what I need.

    Anyway, let's hope this new policy can improve things a little.

  • musicale 2 hours ago
    The iron law of web encrapification: every web feature will (if possible) be employed to abuse the user, usually to push advertising.
    • endgame 2 hours ago
      I cannot even reliably press [Space] any more to page down through sites that are meant to be all about content!
      • kiddico 1 hour ago
        I've always found that behavior baffling so it's interesting to hear someone using it as intended instead of being frustrated by it.
        • asimovDev 27 minutes ago
          i love it. my mac doesn't have the home row (don't know if that's how that row of buttons is called) so I use spacebar and shift+spacebar as pgdown and pgup when I am reading
          • unkl_ 17 minutes ago
            [fn]+[up arrow] = pgup, [fn]+[down arrow] = pgdown, [fn]+[left arrow] = home, [fn]+[right arrow] = end
          • LoganDark 19 minutes ago
            They're called the navigation keys. Fn + Up/Down (arrow keys) is PgUp/PgDn, and Fn + Left/Right is Home/End. But of course, those keys are on completely opposite sides of the keyboard, so Space is more convenient.
      • turtleyacht 1 hour ago
        One more for the spacebar to advance the page. Have never encountered a broken site (so far). Fingers crossed.
    • chongli 2 hours ago
      It really comes down to JavaScript. The web was fine when sites were static HTML, images, and forms with server-side rendering (allowing for forums and blogs).
      • pottertheotter 2 hours ago
        Did you use the web back in 1995? It was fun, but it also sucked compared to what we have now. Nothing is ever perfect, but I wouldn’t want to go back.
        • peterspath 3 minutes ago
          I would also go back in a heartbeat
        • ryandrake 1 hour ago
          I’d go back in a heartbeat. Making the web a software SDK was the worst thing to happen to it.
          • arjie 1 hour ago
            Gemini websites are pretty much the old web: https://en.wikipedia.org/wiki/Gemini_(protocol)

            Both in terms of comprehensiveness and in terms of functionality.

          • collabs 1 hour ago
            You talk about 1995 but I wouldn't even go back to 1999. Dialup was so painful. It advertised 56 know but in practice I never even say 48...
            • yjftsjthsd-h 1 hour ago
              That seems like a separate thing. You can send 199x-era HTML over a gigabit connection.
        • wmf 1 hour ago
          You're not wrong but we've never really tried the combination of modern CSS with no JS. It could produce elegant designs that load really fast... or ad-filled slop but declarative.
        • bonesss 1 hour ago
          I published my first website in 1995 (and while it wasn’t even a little popular, eventually a spammy gay porn site popped up with the exact same joke name, leading to a pretty odd early “what if you search for your own site” experience).

          If you put 2026 media players (with modern bandwidth), on the manually curated small-editorial web of ‘95 it’d be amazing.

          We used to have desktop apps, these SPA JS monstrosities are the result of MS missing the web then MS missing mobile. Instead of a desktop monopoly where ActiveX could pop up (providing better app experiences in many cases than one would think), we have cross-platform electron monstrosities and fat react apps that suck, are slow, and omfgbbq do they break. And suck. And eat up resources. Copy and paste breaks, scrolling breaks, nav gets hijacked, dark mode overridden.

          Netflix, Spotify, MS have apps I see breaking on the regular on prime mainstream hardware. My modern gaming windows laptop, extra juicy GPU for all the LLM and local kubernetes admin, chokes on windows rendering. Windows isn’t just regressing, their entire stack is actively rotting, and all behind fancy web buttons.

          Old man yelling at cloud, but: geeeez boys, I want to go back.

        • themafia 1 hour ago
          > Did you use the web back in 1995?

          I'm still not over the loss of Gopher.

      • AuthAuth 2 hours ago
        It wasnt "fine".
        • atoav 1 hour ago
          Oh, the social media was much, much better. People much more open, tracking didn't exist. All the idiots still thought computers were only a thing for nerds and kids.
    • surcap526 29 minutes ago
      [dead]
  • bob1029 35 minutes ago
    This seems like a good time to advertise the post/redirect/get pattern.

    https://en.wikipedia.org/wiki/Post/Redirect/Get

    Not strictly about hijacking back navigation but it can make experience less bumpy if you've got form submissions in the middle of the path.

    • karim79 31 minutes ago
      I'm a huge fan of this pattern (and as a greybeard). I honestly wonder if people think about such things this day and age where everything is react.
      • koen_hendriks 1 minute ago
        There are frameworks that navigate like this. Laravel is the first that comes to mind. I think Django and Spring do this as well.
  • ffsm8 20 minutes ago
    I would like to mention that Google own SPA framework, angular, has redirect routes which effectively do back button hijacking if used, because they add the url you're redirecting from to the history.

    https://angular.dev/guide/routing/redirecting-routes

  • kristopolous 10 minutes ago
    Almost 30 years ago I wrote an article advocating for domain level back button with a quasi mode like ctrl to traverse domains.

    Would have fixed this. Too late now

  • al_borland 2 hours ago
    Some Microsoft sites have been very guilty of this. They are the ones that stick in my head in recent memory.
    • lamasery 2 hours ago
      IIRC the Azure “portal” does this. Also likes to not record things as navigation events that really feel like they should be. Hitting back on that thing is like hitting the back button on Android, it’s the “I feel lucky” button. Anything could happen.
      • PhageGenerator 1 hour ago
        I think that is because some "pages" are really full screen modals. So the back button does take you back to the previous page, but it looks like you went back two pages (closes modal + goes back). I don't spend too much time in the Azure portal but this behavior is rampant in the Entra admin center.
    • 542458 2 hours ago
      Are they? This seems about deceptive or malicious content (i.e., redirecting to ads) rather than “something in my history triggers a JS redirect”. I’ve definitely experienced the latter with MS, but never the former.
      • surround 2 hours ago
        It seems like Google's policy is unconcerned with the intent of the practice. If a website JS redirect ruins the user experience by breaking the back button, it will be demoted in search results. It doesn't matter whether or not the redirect was meant to be deceptive or malicious, websites shouldn't be ruining the user experience.
        • dataflow 1 hour ago
          > It seems like Google's policy is unconcerned with the intent of the practice.

          I'm reading the opposite: "If you're currently using any script or technique that inserts or replaces deceptive or manipulative pages into a user's browser history that [...]"

    • sixothree 2 hours ago
      Epic store makes it impossible to navigate backwards from the checkout on mobile at least. Not sure if it's design or just poor design.
    • SuperNinKenDo 1 hour ago
      Happened to me yesterday through a link off here. I was already expecting it given the domain, but usually mashing back fast enough does the trick eventually. Not this time. Had to kill the tab.
      • Tepix 1 hour ago
        In most browsers you can hold the back button for a second and it will let you skip back more than one step.
        • AndrewDucker 20 minutes ago
          You can right-click on the back button in Firefox to see a list of previous sites to go back to.
        • Kab1r 1 hour ago
          And some websites consume the entire history that a browser displays in that menu
  • oliwarner 36 minutes ago
    Now do the Amazon app.

    Number of times I've looked for something on my phone, gone through to a product page on Amazon but then have had to back out multiple times to get back to the search listing. Sometimes it's previously viewed products, sometimes it's "just" the Amazon home page. It should be one-and-done.

    eBay too. I'm sure there are others.

  • hysan 1 hour ago
    Took long enough. Maybe I missed it, but I didn’t see them say how invested they are in tackling this. Promoting a rule is one thing, but everything SEO related becomes a cat and mouse game. I don’t have high confidence that this will work.
    • onli 30 minutes ago
      Seems invested enough to me. Adding this to the anti spam policy means they will list sites using this lower or not at all, when detected. And they use automated and manual detection for such things. Not much more they can do? And should be effective, who employs scam tactics like this is also interested in having visitors.
  • slurpyb 27 minutes ago
    Porno sites do this thing where every click is a new tab and when you refocus the previous tab, it reloads to an ad.

    Or so I have been told.

  • mlmonkey 1 hour ago
    But the question is: why are sites allowed to hijack the Back Button?!?
    • josephcsible 1 hour ago
      So that in single-page applications, it can work intuitively instead of always taking you all the way out of the app.
      • not2b 1 hour ago
        If the navigation simulates what would happen if we follow links to SPA#pos1, SPA#pos2, etc so that if I do two clicks within the SPA, and then hit Back three times I'm back to whatever link I followed to get to the SPA, I guess it's OK and follows user expectations. But if it is used as an excuse to trap the user in the SPA unless they kill the tab, not OK.
        • bonesss 1 hour ago
          From the browsers perspective those are the same thing though. It’s a paradigm boundary.

          The real answer is to have desktop applications that work like applications (buttons do what feels right), and websites that work like websites.

          SPA, is a page application. Pages aren’t applications, applications aren’t pages. AutoCAD is an app, the Robotech Encyclopedia is content.

        • mock-possum 1 hour ago
          Of course, but programmatically, how do you enforce that?
          • JoshTriplett 1 hour ago
            Some browser APIs (such as playing video) are locked behind a user interaction. Do the same for the history API: make it so you can't add any items to history until the user clicks a link, and then you can only add one.

            That's not perfect, and it could still be abused, but it might prevent the most common abuses.

            EDIT: apparently Chrome tried that and it wasn't sufficient: https://news.ycombinator.com/item?id=47761349

    • filcuk 1 hour ago
      Because it has a legitimate use. As anything, the tools will be abused by malicious actors
  • G_o_D 14 minutes ago
    Instagram comments page requires 2 quick back press or else it won't take to previous page
  • CableNinja 3 hours ago
    Frustrating it took this long for something to be done about this, but glad its now got something being done.
    • throwaway81523 2 hours ago
      > When a user clicks the "back" button in the browser, they have a clear expectation: they want to return to the previous page. Back button hijacking breaks this fundamental expectation.

      It seems pretty stupid. Instead of expanding the SEO policy bureaucracy to address a situation where a spammer hijacks the back button, the browser should have been designed in the first place to never allow that hijacking to happen. Second best approach is modify it now. While they're at it, they should also make it impossible to hijack the mode one.... oh yes, Google itself does that.

      • spankalee 1 hour ago
        What about all the very legitimate uses of programmatically adding history entries?
        • jack1243star 1 hour ago
          Please explain the legitimate uses. Not once I have ever encountered a website that does something useful by modifying the behavior of my browsing history.
          • venussnatch 55 minutes ago
            Any single page application, such as YouTube, Gmail, or discord.

            It lets persistent content (videos) or connections (chat) persist while emulating a pagenated browsing experience.

            When it's done right you don't notice it at all.

            • jack1243star 11 minutes ago
              (rant warning)

              Well, if I wanted to return to the parent screen in a single page application, I'd click on the back button in the app itself. No need to prevent me from back tracking in the exact order of my browsing should I need it.

              I especially hate YouTube's implementation, I can never know the true state on my older PC during whatever it's trying to accomplish, often playing audio from a previous video when I backspace out. I resort to opening every link in a new tab.

  • monegator 43 minutes ago
    Phew. for a moment there i thought they would start blocking alternate uses of the back button in apps (for like when it means "go back" and when it means "close everything")

    That would have severely rustled my jimmies

  • dnnddidiej 1 hour ago
    Easy fix:

    JS doesn't let you change back button behaviour.

    Q. But what about SPA?

    A. Draw your own app-level back button top left of page.

    Another solution: make it a permisson.

    • kaelwd 45 minutes ago
      Can I preventDefault on mouse5? What about the physical back button on Android?
    • sublinear 8 minutes ago
      Why not just put up a fake captcha page? When the user clicks the link to continue, the back button is now hijacked.
    • Hamuko 49 minutes ago
      >Draw your own app-level back button top left of page.

      This is the worst idea I’ve heard all day.

  • NooneAtAll3 34 minutes ago
    is there a policy on "home button hijacking"?

    I'm tired of apps that intercept home button to ask "are you sure?" - home button is home button, return me to the main phone screen

    also, ads at the bottom of the screen, so that if you miss home button you open a website

  • psidium 1 hour ago
    Ironically, we have an infringing website right now on the front-page of HN (nypost).
  • twism 2 hours ago
    Reddit! I'm looking at you?
    • itopaloglu83 1 hour ago
      Scroll on Reddit on mobile and click on a link. The comments open in a new tab. Close the tab and the previous tab is also at the link you’ve just closed.

      Makes it impossible to browse around and long click to open on a new tab doesn’t solve the issue either.

      • kaelwd 29 minutes ago
        And if the tab was unloaded then you press back it changes the URL but not the actual contents of the page.
    • rc_kas 1 hour ago
      I feel like facebook is the worst culprit with this
  • transcriptase 1 hour ago
    >We believe that the user experience comes first

    I’ll believe that when YouTube gives me the ability to block certain channels versus “not interested” and “don’t recommend channel” buttons that do absolutely nothing close to what I want.

    Or a thousand other things, but that one in particular has been top of mind recently.

    • PeterStuer 54 minutes ago
      Let me permanently hide "shorts".
    • bot403 1 hour ago
      Or if they ever bring back the "ignore this domain" feature so we can ignore ai slop and copycat sites.

      It's why I went to Kagi.

  • bschwindHN 2 hours ago
    Cool, now maybe let's do something about all the shit I have to clear out out my face before I can read a simple web page. For example, on this very article I had to click "No thanks" for cookies and then "No thanks" for a survey or something. And then there was an ad at the top for some app that I also closed.

    It's like walking into some room and having to swat away a bunch of cobwebs before doing whatever it is you want to do (read some text, basically).

    • not_your_vase 2 hours ago
      Haha, we had a solution for that, called pop-up blockers. Then when they became very usable, everyone switched to overlays injected with javascript, so they became unblockable.

      But thinking of this at this moment, this could be a good use for a locally ran LLM, to get rid of all this crap dynamically. I wonder why Firefox didn't use this as a usecase when they bolted AI on top of Firefox. Maybe it is time for me to check what api FF has for this

      • Terr_ 1 hour ago
        I'm waiting for someone to develop an augmented-reality system that detects branded ads or products, compares them against a corporate-ownership database, applies policies chosen by the user, and then adds warning-stripes or censor-bars over things the user has selected against.

        It would finally put some teeth behind the myth of the informed consumer, and there would be gloriously absurd court-battles from corporations. ("This is our freedom of speech and commerce, it's essential, if people don't like what we're doing they can vote with their wallets... NOT LIKE THAT STOP USING SPEECH AND COMMERCE!")

    • internet101010 2 hours ago
      Don't forget the useless "Got it!" popups, especially when the site blurs the screen to guide you to it.
    • pwg 2 hours ago
      With uBlockOrigin set to default deny all the javascript on the page there are:

      zero cookie banners

      zero surveys popping up

      zero ads to be closed

      Just the text of the page with no other distractions in the way.

    • 93po 1 hour ago
      ublock origin with annoyance filters on solves 95% of this
    • carlosjobim 1 hour ago
      Your problems have been solved for more than a decade. Set your browser to open pages in reader view by default and you don't have these issues.
  • synack 2 hours ago
    Are they considering all uses of window.history.pushState to be hijacking? If so, why not remove that function from Chrome?
    • tgsovlerkhgsel 2 hours ago
      Because clicking on a navigation button in a web app is a good reason to window.history.pushState a state that will return the user to the place where they were when they clicked the button.

      Clicking the dismiss button on the cookie banner is not a reason to push a state that will show the user a screen full of ads when they try to leave. (Mentioning the cookie banner because AFAIK Chrome requires a "user gesture" before pushState works normally, https://groups.google.com/a/chromium.org/g/blink-dev/c/T8d4_...)

    • kro 1 hour ago
      It's a valid question how they detect it. As there are valid usages, just checking for the existence of the function call would not be correct.

      These sites likely pushState on consent actions so it appears like any user interaction.

    • omcnoe 2 hours ago
      No, only if your website abuses window.history.pushState to redirect the user to spam/ad content is it considered abuse.
  • imiric 31 minutes ago
    > We believe that the user experience comes first.

    If by "user" you mean advertisers, sure you do. Everyone else is an asset to extract as much value from as possible. You actively corrupt their experience.

    The fact these companies control the web and its major platforms is one of the greatest tragedies of the modern era.

  • kstenerud 41 minutes ago
    Now if only they'd do this for Android apps that hijack the back button to pop up things, or say "are you sure you want to leave?"
  • sublinear 52 minutes ago
    > Notably, some instances of back button hijacking may originate from the site's included libraries or advertising platform. We encourage site owners to thoroughly review their technical implementation...

    Hah. In my time working with marketing teams this is highly unlikely to happen. They're allergic to code and they far outnumber everyone else in this space. Their best practices become the standard for everyone else that's uninitiated.

    What they will probably do is change that vanity URL showing up on the SERP to point to a landing page that meets the requirements (only if the referer is google). This page will have the link the user wants. It will be dressed up to be as irresistible as possible. This will become the new best practice in the docs for all SEO-related tools. Hell, even google themselves might eventually put that in their docs.

    In other words, the user must now click twice to find the page with the back button hijacking. Even sweeter is that the unfettered back button wouldn't have left their domain anyway.

    This just sounds like another layer of yet more frustration. Contrary to popular belief, the user will put up with a lot of additional friction if they think they're going somewhere good. This is just an extra click. Most users probably won't even notice the change. If anything there will be propaganda aimed at aspiring web devs and power users telling them to get mad at google for "requiring" landing pages getting in the way of the content (like what happened to amp pages).

  • incognito124 1 hour ago
    Now, if they only declared scroll hijacking as spam...
  • Animats 30 minutes ago
    Now to prevent scroll bar hijacking.
  • charcircuit 2 hours ago
    Google should actually fix this from the browser side instead of trying to seriously punish potentially buggy sites.
    • domenicd 1 hour ago
      We tried a few times. We got as far as gating the ability to push into the "real history stack" [1] behind a user activation (e.g. click). But, it's easy to get the user to click somewhere: just throw up a cookie banner or an "expand to see full article" or similar.

      We weren't really able to figure out any technical solution beyond this. It would rely on some sort of classification of clicks as leading to "real" same-document navigations or not.

      This can be done reasonably well as long as you're in a cooperative relationship with the website. For example, if you're trying to classify whether a click should emit single-page navigation performance entries for web performance measurement. (See [2].) In such a case, if the browser can get to (say) 99% accuracy by default with good heuristics and provide site owners with guidance on how to annotate or tweak their code for the remaining 1%, you're in good shape.

      But if you're in an adversarial relationship with the website, i.e. it's some malicious spammer trying to hijack the back button, then the malicious site will just always go down the 1% path that slips through the browser's heuristics. And you can try playing whack-a-mole with certain code patterns, but it just never ends, and isn't a great use of engineering resources, and is likely to start degrading the experience of well-behaved sites by accident.

      So, policy-based solutions make sense to me here.

      [1]: "real history stack": by this I mean the user-visible one that is traversed by the browser's back button UI. This is distinct from the programmer-visible one in `navigation.entries()`, traversed by `navigation.back()` or `history.back()`. The browser's back button is explicitly allowed to skip over programmer-visible entries. https://html.spec.whatwg.org/multipage/speculative-loading.h...

      [2]: https://developer.chrome.com/docs/web-platform/soft-navigati...

      • themafia 1 hour ago
        The back button itself feels overloaded. There's "go to previous state" and then there's "go to previous origin." In an ideal world when I doubleclick on the back button what I mean is: "get me off of this site, now."
    • josephcsible 1 hour ago
      What does this have to do with sites being buggy? This change is about obvious intentional abuse.
    • SuperNinKenDo 1 hour ago
      Honestly if your site is buggy in a way that effectively breaks the browser, maybe you should be punished.
      • bot403 1 hour ago
        I recommend 14 days in jail for the site owner, and, if egregarious, the engineer as well.

        Not life ruining but just enough to be annoying. Just like their website.

  • tgsovlerkhgsel 2 hours ago
    Now do paywalls next.
    • ladberg 1 hour ago
      How would you recommend that creators of valuable content get paid?
      • renewiltord 1 hour ago
        Ideally, when I create valuable content I am paid and when I consume valuable content I don't pay. Advertising does this but I hate it so I don't want that. So ideally, there is no way to extract value from me but I am able to extract value from others. I think I would support someone who finds a way to enforce this.

        But I am also willing to pay for valuable content an exorbitant amount if it is valuable enough. For instance, for absolutely critical information I might pay 0.79€ a month.

  • andrewmcwatters 2 hours ago
    [dead]