TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Stealing the users back button with the History API (2013)

31 pointsby longrodalmost 3 years ago

7 comments

car_analogyalmost 3 years ago
History <i>API</i>? Modifying user history should require an exploit, not be offered voluntarily by the browser!
评论 #31697196 未加载
评论 #31697317 未加载
评论 #31700799 未加载
评论 #31698468 未加载
fleddralmost 3 years ago
For the interested, the successor to the History API is the Navigation API: <a href="https:&#x2F;&#x2F;developer.chrome.com&#x2F;docs&#x2F;web-platform&#x2F;navigation-api&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developer.chrome.com&#x2F;docs&#x2F;web-platform&#x2F;navigation-ap...</a>
superasnalmost 3 years ago
I think a simple website redirect middleware can do this and much more reliably. If a site is being shady there is hardly a way to stop it.<p>Step 1: Redirect middleware checks for a cookie say &#x27;A&#x27;<p>Step 2: If no cookie, set cookie and redirect to main content.<p>Step 3: User presses back button, comes to redirect middleware which sees cookie &#x27;A&#x27; and this time it redirects to another shady website.
thunderbongalmost 3 years ago
Didn&#x27;t work for me though on Chrome or Slimjet. Worked in Firefox!<p>On Chrome based browsers, I see this error -<p><pre><code> [Report Only] Refused to load the script &#x27;https:&#x2F;&#x2F;ryanseddon.com&#x2F;dist&#x2F;app.bundle.js&#x27; because it violates the following Content Security Policy directive: &quot;script-src &#x27;self&#x27; &#x27;sha256-MdC6fOvaO+dJENLQhOoRht9sHSJ++GoMxjtC5lOpUww=&#x27; &#x27;strict-dynamic&#x27; https: &#x27;unsafe-inline&#x27; &#x27;report-sample&#x27;&quot;. &#x27;strict-dynamic&#x27; is present, so host-based whitelisting is disabled. Note that &#x27;script-src-elem&#x27; was not explicitly set, so &#x27;script-src&#x27; is used as a fallback.</code></pre>
评论 #31698641 未加载
superb-owlalmost 3 years ago
Huh...so you can add a third-party domain to the history? That seems like a security flaw. I would have imagined you could only add history for the current domain.
评论 #31697559 未加载
kurupt213almost 3 years ago
I don’t know why people do this because this is what makes people avoid your website completely. Fool me once…never again
jawmes8almost 3 years ago
Never understood why sites do that. Do they expect me to stick around and click some ads? I usually just close the tab and move on
评论 #31700769 未加载